2 synth_stereo_sse_s32: SSE optimized synth (stereo specific, s32 output version)
4 copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Taihei Monma
20 #define TEMP(n) (12+16*n)(%esp)
21 #define MMREG_CLIP %mm7
24 int synth_1to1_s32_stereo_sse_asm(real *window, real *b0l, real *b0r, int32_t *samples, int bo1);
25 return value: number of clipped samples
35 .long 1199570944 /* 65536.0 */
41 .long 1191182335 /* 32767.999 */
45 .long -956301312 /* -32768.0 */
51 .globl ASM_NAME(synth_1to1_s32_stereo_sse_asm)
52 ASM_NAME(synth_1to1_s32_stereo_sse_asm):
61 pxor MMREG_CLIP, MMREG_CLIP
66 movl 20(%ebp), SAMPLES
70 leal 64(WINDOW), WINDOW
77 movups (WINDOW), %xmm0
78 movups 16(WINDOW), %xmm1
79 movups 32(WINDOW), %xmm2
80 movups 48(WINDOW), %xmm3
100 movaps %xmm4, TEMP(4)
102 leal 128(WINDOW), WINDOW
106 movups (WINDOW), %xmm0
107 movups 16(WINDOW), %xmm1
108 movups 32(WINDOW), %xmm2
109 movups 48(WINDOW), %xmm3
128 movaps %xmm0, TEMP(1)
129 movaps %xmm4, TEMP(5)
131 leal 128(WINDOW), WINDOW
135 movups (WINDOW), %xmm0
136 movups 16(WINDOW), %xmm1
137 movups 32(WINDOW), %xmm2
138 movups 48(WINDOW), %xmm3
157 movaps %xmm0, TEMP(2)
158 movaps %xmm4, TEMP(6)
160 leal 128(WINDOW), WINDOW
164 movups (WINDOW), %xmm0
165 movups 16(WINDOW), %xmm1
166 movups 32(WINDOW), %xmm2
167 movups 48(WINDOW), %xmm3
187 movaps %xmm4, TEMP(7)
189 leal 128(WINDOW), WINDOW
193 movaps TEMP(0), %xmm4
194 movaps TEMP(1), %xmm5
195 movaps TEMP(2), %xmm6
198 unpcklps %xmm5, %xmm4
199 unpcklps %xmm7, %xmm6
200 unpckhps %xmm5, %xmm0
201 unpckhps %xmm7, %xmm1
213 movaps TEMP(4), %xmm4
214 movaps TEMP(5), %xmm5
215 movaps TEMP(6), %xmm6
216 movaps TEMP(7), %xmm7
219 unpcklps %xmm5, %xmm4
220 unpcklps %xmm7, %xmm6
221 unpckhps %xmm5, %xmm0
222 unpckhps %xmm7, %xmm1
238 mulps ASM_NAME(scale_s32), %xmm5
239 mulps ASM_NAME(scale_s32), %xmm0
240 cmpnleps ASM_NAME(maxmin_s32), %xmm1
241 cmpltps ASM_NAME(maxmin_s32)+16, %xmm2
242 cmpnleps ASM_NAME(maxmin_s32), %xmm3
243 cmpltps ASM_NAME(maxmin_s32)+16, %xmm4
256 movq %mm4, 8(SAMPLES)
272 movq %mm0, 16(SAMPLES)
273 movq %mm6, 24(SAMPLES)
292 paddw %mm0, MMREG_CLIP
294 leal 32(SAMPLES), SAMPLES
302 movups (WINDOW), %xmm0
303 movups 16(WINDOW), %xmm1
304 movups 32(WINDOW), %xmm2
305 movups 48(WINDOW), %xmm3
324 movaps %xmm0, TEMP(0)
325 movaps %xmm4, TEMP(4)
327 leal 128(WINDOW), WINDOW
331 movups (WINDOW), %xmm0
332 movups 16(WINDOW), %xmm1
333 movups 32(WINDOW), %xmm2
334 movups 48(WINDOW), %xmm3
353 movaps %xmm0, TEMP(1)
354 movaps %xmm4, TEMP(5)
356 leal 128(WINDOW), WINDOW
360 movups (WINDOW), %xmm0
361 movups 16(WINDOW), %xmm1
362 movups 32(WINDOW), %xmm2
363 movups 48(WINDOW), %xmm3
382 movaps %xmm0, TEMP(2)
383 movaps %xmm4, TEMP(6)
385 leal 128(WINDOW), WINDOW
389 movups (WINDOW), %xmm0
390 movups 16(WINDOW), %xmm1
391 movups 32(WINDOW), %xmm2
392 movups 48(WINDOW), %xmm3
412 movaps %xmm4, TEMP(7)
414 leal 128(WINDOW), WINDOW
418 movaps TEMP(0), %xmm4
419 movaps TEMP(1), %xmm5
420 movaps TEMP(2), %xmm6
423 unpcklps %xmm5, %xmm4
424 unpcklps %xmm7, %xmm6
425 unpckhps %xmm5, %xmm0
426 unpckhps %xmm7, %xmm1
438 movaps TEMP(4), %xmm4
439 movaps TEMP(5), %xmm5
440 movaps TEMP(6), %xmm6
441 movaps TEMP(7), %xmm7
444 unpcklps %xmm5, %xmm4
445 unpcklps %xmm7, %xmm6
446 unpckhps %xmm5, %xmm0
447 unpckhps %xmm7, %xmm1
463 mulps ASM_NAME(scale_s32), %xmm5
464 mulps ASM_NAME(scale_s32), %xmm0
465 cmpnleps ASM_NAME(maxmin_s32), %xmm1
466 cmpltps ASM_NAME(maxmin_s32)+16, %xmm2
467 cmpnleps ASM_NAME(maxmin_s32), %xmm3
468 cmpltps ASM_NAME(maxmin_s32)+16, %xmm4
481 movq %mm4, 8(SAMPLES)
497 movq %mm0, 16(SAMPLES)
498 movq %mm6, 24(SAMPLES)
517 paddw %mm0, MMREG_CLIP
519 leal 32(SAMPLES), SAMPLES
523 pshufw $0xee, MMREG_CLIP, %mm0
524 paddw MMREG_CLIP, %mm0
525 pshufw $0x55, %mm0, %mm1