Add wrapper methods to ensure aligned allocations
[openal-soft/openal-hmr.git] / Alc / mixer_sse.c
blob2da2b6b82ec21ea15de971efab4a95ec23654c46
1 #include "config.h"
3 #ifdef HAVE_XMMINTRIN_H
4 #include <xmmintrin.h>
5 #endif
7 #include "AL/al.h"
8 #include "AL/alc.h"
9 #include "alMain.h"
10 #include "alu.h"
13 static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2],
14 ALfloat (*RESTRICT Coeffs)[2],
15 ALfloat left, ALfloat right)
17 const __m128 lrlr = { left, right, left, right };
18 ALuint c;
19 for(c = 0;c < HRIR_LENGTH;c += 2)
21 const ALuint o0 = (Offset++)&HRIR_MASK;
22 const ALuint o1 = (Offset++)&HRIR_MASK;
23 __m128 coeffs = _mm_load_ps(&Coeffs[c][0]);
24 __m128 vals = { 0.0f, 0.0f, 0.0f, 0.0f };
25 vals = _mm_loadl_pi(vals, (__m64*)&Values[o0][0]);
26 vals = _mm_loadh_pi(vals, (__m64*)&Values[o1][0]);
28 vals = _mm_add_ps(vals, _mm_mul_ps(coeffs, lrlr));
29 _mm_storel_pi((__m64*)&Values[o0][0], vals);
30 _mm_storeh_pi((__m64*)&Values[o1][0], vals);
34 #define SUFFIX SSE
35 #define SAMPLER point32
36 #include "mixer_inc.c"
37 #undef SAMPLER
38 #define SAMPLER lerp32
39 #include "mixer_inc.c"
40 #undef SAMPLER
41 #define SAMPLER cubic32
42 #include "mixer_inc.c"
43 #undef SAMPLER
44 #undef SUFFIX