fork/rust-sdks

git clone https://git.julia.blue/fork/rust-sdks

Théo Monnomsoxr-sys (#438)2e4d385

main
1.2 KiB42 linesraw
1/* SoX Resampler Library      Copyright (c) 2007-16 robs@users.sourceforge.net
2 * Licence for this file: LGPL v2.1                  See LICENCE for details. */
3
4#if !defined soxr_dev64s_included
5#define soxr_dev64s_included
6
7#if defined __GNUC__
8  #define SIMD_INLINE(T) static __inline T __attribute__((always_inline))
9  #define vAlign __attribute__((aligned (32)))
10#elif defined _MSC_VER
11  #define SIMD_INLINE(T) static __forceinline T
12  #define vAlign __declspec(align(32))
13#else
14  #define SIMD_INLINE(T) static __inline T
15#endif
16
17#if defined __x86_64__ || defined _M_X64 || defined i386 || defined _M_IX86
18
19#include <immintrin.h>
20
21#if defined __AVX__
22
23#define vZero()      _mm256_setzero_pd()
24#define vSet1(a)     _mm256_set_pd(0,0,0,a)
25#define vMul(a,b)    _mm256_mul_pd(a,b)
26#define vAdd(a,b)    _mm256_add_pd(a,b)
27#define vMac(a,b,c)  vAdd(vMul(a,b),c) /* Note: gcc -mfma will `fuse' these */
28#define vLds(a)      _mm256_set1_pd(a)
29#define vLd(a)       _mm256_load_pd(a)
30#define vLdu(a)      _mm256_loadu_pd(a)
31
32typedef __m256d v4_t;
33
34SIMD_INLINE(void) vStorSum(double * a, v4_t b) {
35  b = _mm256_hadd_pd(b, _mm256_permute2f128_pd(b,b,1));
36  _mm_store_sd(a, _mm256_castpd256_pd128(_mm256_hadd_pd(b,b)));}
37
38#endif
39
40#endif
41
42#endif