fork/rust-sdks
git clone https://git.julia.blue/fork/rust-sdks
2e4d385
main
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 !definedsoxr_dev32s_included 5#define soxr_dev32s_included 6 7#if defined__GNUC__ 8#define SIMD_INLINE (T ) static __inline T __attribute__((always_inline)) 9#define vAlign __attribute__((aligned (16))) 10#elif defined_MSC_VER 11#define SIMD_INLINE (T ) static __forceinline T 12#define vAlign __declspec(align(16)) 13#endif 14 15#if defined__x86_64__ || defined_M_X64 || definedi386 || defined_M_IX86 16 17#include <xmmintrin.h> 18 19#define vZero () _mm_setzero_ps() 20#define vSet1 (a ) _mm_set_ss(a) 21#define vMul (a ,b ) _mm_mul_ps(a,b) 22#define vAdd (a ,b ) _mm_add_ps(a,b) 23#define vMac (a ,b ,c ) vAdd(vMul(a,b),c) 24#define vLds (a ) _mm_set1_ps(a) 25#define vLd (a ) _mm_load_ps(a) 26#define vLdu (a ) _mm_loadu_ps(a) 27 28typedef __m128 v4_t ; 29 30SIMD_INLINE (void )vStorSum (float * a ,v4_t b ) { 31v4_t t = vAdd (_mm_movehl_ps (b ,b ),b ); 32_mm_store_ss (a ,vAdd (t ,_mm_shuffle_ps (t ,t ,1 )));} 33 34#elif defined__arm__ 35 36#include <arm_neon.h> 37 38#define vZero () vdupq_n_f32(0) 39#define vMul (a ,b ) vmulq_f32(a,b) 40#define vAdd (a ,b ) vaddq_f32(a,b) 41#define vMac (a ,b ,c ) vmlaq_f32(c,a,b) 42#define vLds (a ) vld1q_dup_f32(&(a)) 43#define vLd (a ) vld1q_f32(a) 44#define vLdu (a ) vld1q_f32(a) 45 46typedef float32x4_t v4_t ; 47 48SIMD_INLINE (void )vStorSum (float * a ,v4_t b ) { 49float32x2_t t = vadd_f32 (vget_high_f32 (b ),vget_low_f32 (b )); 50* a = vget_lane_f32 (vpadd_f32 (t ,t ),0 );} 51 52#endif 53 54#endif