Mercurial > mplayer.hg
comparison liba52/resample_mmx.c @ 27754:08d18fe9da52
Change all occurrences of asm and __asm to __asm__, same as was done for FFmpeg.
Neither variant is valid C99 syntax, but __asm__ is the most portable variant.
author | diego |
---|---|
date | Thu, 16 Oct 2008 18:59:27 +0000 |
parents | 943f37a4323d |
children | 25337a2147e7 |
comparison
equal
deleted
inserted
replaced
27753:6c915906bbc6 | 27754:08d18fe9da52 |
---|---|
36 static uint64_t attribute_used __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL; | 36 static uint64_t attribute_used __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL; |
37 static uint64_t attribute_used __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL; | 37 static uint64_t attribute_used __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL; |
38 | 38 |
39 static int a52_resample_MONO_to_5_MMX(float * _f, int16_t * s16){ | 39 static int a52_resample_MONO_to_5_MMX(float * _f, int16_t * s16){ |
40 int32_t * f = (int32_t *) _f; | 40 int32_t * f = (int32_t *) _f; |
41 asm volatile( | 41 __asm__ volatile( |
42 "mov $-512, %%"REG_S" \n\t" | 42 "mov $-512, %%"REG_S" \n\t" |
43 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 43 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
44 "movq "MANGLE(wm1100)", %%mm3 \n\t" | 44 "movq "MANGLE(wm1100)", %%mm3 \n\t" |
45 "movq "MANGLE(wm0101)", %%mm4 \n\t" | 45 "movq "MANGLE(wm0101)", %%mm4 \n\t" |
46 "movq "MANGLE(wm1010)", %%mm5 \n\t" | 46 "movq "MANGLE(wm1010)", %%mm5 \n\t" |
75 | 75 |
76 static int a52_resample_STEREO_to_2_MMX(float * _f, int16_t * s16){ | 76 static int a52_resample_STEREO_to_2_MMX(float * _f, int16_t * s16){ |
77 int32_t * f = (int32_t *) _f; | 77 int32_t * f = (int32_t *) _f; |
78 /* benchmark scores are 0.3% better with SSE but we would need to set bias=0 and premultiply it | 78 /* benchmark scores are 0.3% better with SSE but we would need to set bias=0 and premultiply it |
79 #ifdef HAVE_SSE | 79 #ifdef HAVE_SSE |
80 asm volatile( | 80 __asm__ volatile( |
81 "mov $-1024, %%"REG_S" \n\t" | 81 "mov $-1024, %%"REG_S" \n\t" |
82 "1: \n\t" | 82 "1: \n\t" |
83 "cvtps2pi (%1, %%"REG_S"), %%mm0\n\t" | 83 "cvtps2pi (%1, %%"REG_S"), %%mm0\n\t" |
84 "cvtps2pi 1024(%1, %%"REG_S"), %%mm2\n\t" | 84 "cvtps2pi 1024(%1, %%"REG_S"), %%mm2\n\t" |
85 "movq %%mm0, %%mm1 \n\t" | 85 "movq %%mm0, %%mm1 \n\t" |
91 " jnz 1b \n\t" | 91 " jnz 1b \n\t" |
92 "emms \n\t" | 92 "emms \n\t" |
93 :: "r" (s16+512), "r" (f+256) | 93 :: "r" (s16+512), "r" (f+256) |
94 :"%"REG_S, "memory" | 94 :"%"REG_S, "memory" |
95 );*/ | 95 );*/ |
96 asm volatile( | 96 __asm__ volatile( |
97 "mov $-1024, %%"REG_S" \n\t" | 97 "mov $-1024, %%"REG_S" \n\t" |
98 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 98 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
99 "1: \n\t" | 99 "1: \n\t" |
100 "movq (%1, %%"REG_S"), %%mm0 \n\t" | 100 "movq (%1, %%"REG_S"), %%mm0 \n\t" |
101 "movq 8(%1, %%"REG_S"), %%mm1 \n\t" | 101 "movq 8(%1, %%"REG_S"), %%mm1 \n\t" |
121 return 2*256; | 121 return 2*256; |
122 } | 122 } |
123 | 123 |
124 static int a52_resample_3F_to_5_MMX(float * _f, int16_t * s16){ | 124 static int a52_resample_3F_to_5_MMX(float * _f, int16_t * s16){ |
125 int32_t * f = (int32_t *) _f; | 125 int32_t * f = (int32_t *) _f; |
126 asm volatile( | 126 __asm__ volatile( |
127 "mov $-1024, %%"REG_S" \n\t" | 127 "mov $-1024, %%"REG_S" \n\t" |
128 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 128 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
129 "pxor %%mm6, %%mm6 \n\t" | 129 "pxor %%mm6, %%mm6 \n\t" |
130 "movq %%mm7, %%mm5 \n\t" | 130 "movq %%mm7, %%mm5 \n\t" |
131 "punpckldq %%mm6, %%mm5 \n\t" | 131 "punpckldq %%mm6, %%mm5 \n\t" |
175 return 5*256; | 175 return 5*256; |
176 } | 176 } |
177 | 177 |
178 static int a52_resample_2F_2R_to_4_MMX(float * _f, int16_t * s16){ | 178 static int a52_resample_2F_2R_to_4_MMX(float * _f, int16_t * s16){ |
179 int32_t * f = (int32_t *) _f; | 179 int32_t * f = (int32_t *) _f; |
180 asm volatile( | 180 __asm__ volatile( |
181 "mov $-1024, %%"REG_S" \n\t" | 181 "mov $-1024, %%"REG_S" \n\t" |
182 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 182 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
183 "1: \n\t" | 183 "1: \n\t" |
184 "movq (%1, %%"REG_S"), %%mm0 \n\t" | 184 "movq (%1, %%"REG_S"), %%mm0 \n\t" |
185 "movq 8(%1, %%"REG_S"), %%mm1 \n\t" | 185 "movq 8(%1, %%"REG_S"), %%mm1 \n\t" |
226 return 4*256; | 226 return 4*256; |
227 } | 227 } |
228 | 228 |
229 static int a52_resample_3F_2R_to_5_MMX(float * _f, int16_t * s16){ | 229 static int a52_resample_3F_2R_to_5_MMX(float * _f, int16_t * s16){ |
230 int32_t * f = (int32_t *) _f; | 230 int32_t * f = (int32_t *) _f; |
231 asm volatile( | 231 __asm__ volatile( |
232 "mov $-1024, %%"REG_S" \n\t" | 232 "mov $-1024, %%"REG_S" \n\t" |
233 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 233 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
234 "1: \n\t" | 234 "1: \n\t" |
235 "movd (%1, %%"REG_S"), %%mm0 \n\t" | 235 "movd (%1, %%"REG_S"), %%mm0 \n\t" |
236 "punpckldq 2048(%1, %%"REG_S"), %%mm0\n\t" | 236 "punpckldq 2048(%1, %%"REG_S"), %%mm0\n\t" |
285 return 5*256; | 285 return 5*256; |
286 } | 286 } |
287 | 287 |
288 static int a52_resample_MONO_LFE_to_6_MMX(float * _f, int16_t * s16){ | 288 static int a52_resample_MONO_LFE_to_6_MMX(float * _f, int16_t * s16){ |
289 int32_t * f = (int32_t *) _f; | 289 int32_t * f = (int32_t *) _f; |
290 asm volatile( | 290 __asm__ volatile( |
291 "mov $-1024, %%"REG_S" \n\t" | 291 "mov $-1024, %%"REG_S" \n\t" |
292 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 292 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
293 "pxor %%mm6, %%mm6 \n\t" | 293 "pxor %%mm6, %%mm6 \n\t" |
294 "1: \n\t" | 294 "1: \n\t" |
295 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" | 295 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" |
325 return 6*256; | 325 return 6*256; |
326 } | 326 } |
327 | 327 |
328 static int a52_resample_STEREO_LFE_to_6_MMX(float * _f, int16_t * s16){ | 328 static int a52_resample_STEREO_LFE_to_6_MMX(float * _f, int16_t * s16){ |
329 int32_t * f = (int32_t *) _f; | 329 int32_t * f = (int32_t *) _f; |
330 asm volatile( | 330 __asm__ volatile( |
331 "mov $-1024, %%"REG_S" \n\t" | 331 "mov $-1024, %%"REG_S" \n\t" |
332 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 332 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
333 "pxor %%mm6, %%mm6 \n\t" | 333 "pxor %%mm6, %%mm6 \n\t" |
334 "1: \n\t" | 334 "1: \n\t" |
335 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" | 335 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" |
363 return 6*256; | 363 return 6*256; |
364 } | 364 } |
365 | 365 |
366 static int a52_resample_3F_LFE_to_6_MMX(float * _f, int16_t * s16){ | 366 static int a52_resample_3F_LFE_to_6_MMX(float * _f, int16_t * s16){ |
367 int32_t * f = (int32_t *) _f; | 367 int32_t * f = (int32_t *) _f; |
368 asm volatile( | 368 __asm__ volatile( |
369 "mov $-1024, %%"REG_S" \n\t" | 369 "mov $-1024, %%"REG_S" \n\t" |
370 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 370 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
371 "pxor %%mm6, %%mm6 \n\t" | 371 "pxor %%mm6, %%mm6 \n\t" |
372 "1: \n\t" | 372 "1: \n\t" |
373 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" | 373 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" |
403 return 6*256; | 403 return 6*256; |
404 } | 404 } |
405 | 405 |
406 static int a52_resample_2F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){ | 406 static int a52_resample_2F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){ |
407 int32_t * f = (int32_t *) _f; | 407 int32_t * f = (int32_t *) _f; |
408 asm volatile( | 408 __asm__ volatile( |
409 "mov $-1024, %%"REG_S" \n\t" | 409 "mov $-1024, %%"REG_S" \n\t" |
410 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 410 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
411 // "pxor %%mm6, %%mm6 \n\t" | 411 // "pxor %%mm6, %%mm6 \n\t" |
412 "1: \n\t" | 412 "1: \n\t" |
413 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" | 413 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" |
449 return 6*256; | 449 return 6*256; |
450 } | 450 } |
451 | 451 |
452 static int a52_resample_3F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){ | 452 static int a52_resample_3F_2R_LFE_to_6_MMX(float * _f, int16_t * s16){ |
453 int32_t * f = (int32_t *) _f; | 453 int32_t * f = (int32_t *) _f; |
454 asm volatile( | 454 __asm__ volatile( |
455 "mov $-1024, %%"REG_S" \n\t" | 455 "mov $-1024, %%"REG_S" \n\t" |
456 "movq "MANGLE(magicF2W)", %%mm7 \n\t" | 456 "movq "MANGLE(magicF2W)", %%mm7 \n\t" |
457 // "pxor %%mm6, %%mm6 \n\t" | 457 // "pxor %%mm6, %%mm6 \n\t" |
458 "1: \n\t" | 458 "1: \n\t" |
459 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" | 459 "movq 1024(%1, %%"REG_S"), %%mm0\n\t" |