comparison i386/dsputil_mmx_avg.h @ 8031:eebc7209c47f libavcodec

Convert asm keyword into __asm__. Neither the asm() nor the __asm__() keyword is part of the C99 standard, but while GCC accepts the former in C89 syntax, it is not accepted in C99 unless GNU extensions are turned on (with -fasm). The latter form is accepted in any syntax as an extension (without requiring further command-line options). Sun Studio C99 compiler also does not accept asm() while accepting __asm__(), albeit reporting warnings that it's not valid C99 syntax.
author flameeyes
date Thu, 16 Oct 2008 13:34:09 +0000
parents 33896780c612
children
comparison
equal deleted inserted replaced
8030:a512ac8fa540 8031:eebc7209c47f
31 /* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm 31 /* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
32 clobber bug - now it will work with 2.95.2 and also with -fPIC 32 clobber bug - now it will work with 2.95.2 and also with -fPIC
33 */ 33 */
34 static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 34 static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
35 { 35 {
36 asm volatile( 36 __asm__ volatile(
37 "lea (%3, %3), %%"REG_a" \n\t" 37 "lea (%3, %3), %%"REG_a" \n\t"
38 "1: \n\t" 38 "1: \n\t"
39 "movq (%1), %%mm0 \n\t" 39 "movq (%1), %%mm0 \n\t"
40 "movq (%1, %3), %%mm1 \n\t" 40 "movq (%1, %3), %%mm1 \n\t"
41 PAVGB" 1(%1), %%mm0 \n\t" 41 PAVGB" 1(%1), %%mm0 \n\t"
59 :"%"REG_a, "memory"); 59 :"%"REG_a, "memory");
60 } 60 }
61 61
62 static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 62 static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
63 { 63 {
64 asm volatile( 64 __asm__ volatile(
65 "testl $1, %0 \n\t" 65 "testl $1, %0 \n\t"
66 " jz 1f \n\t" 66 " jz 1f \n\t"
67 "movd (%1), %%mm0 \n\t" 67 "movd (%1), %%mm0 \n\t"
68 "movd (%2), %%mm1 \n\t" 68 "movd (%2), %%mm1 \n\t"
69 "add %4, %1 \n\t" 69 "add %4, %1 \n\t"
110 } 110 }
111 111
112 112
113 static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 113 static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
114 { 114 {
115 asm volatile( 115 __asm__ volatile(
116 "testl $1, %0 \n\t" 116 "testl $1, %0 \n\t"
117 " jz 1f \n\t" 117 " jz 1f \n\t"
118 "movq (%1), %%mm0 \n\t" 118 "movq (%1), %%mm0 \n\t"
119 "movq (%2), %%mm1 \n\t" 119 "movq (%2), %%mm1 \n\t"
120 "add %4, %1 \n\t" 120 "add %4, %1 \n\t"
160 :"memory");*/ 160 :"memory");*/
161 } 161 }
162 162
163 static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 163 static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
164 { 164 {
165 asm volatile( 165 __asm__ volatile(
166 "pcmpeqb %%mm6, %%mm6 \n\t" 166 "pcmpeqb %%mm6, %%mm6 \n\t"
167 "testl $1, %0 \n\t" 167 "testl $1, %0 \n\t"
168 " jz 1f \n\t" 168 " jz 1f \n\t"
169 "movq (%1), %%mm0 \n\t" 169 "movq (%1), %%mm0 \n\t"
170 "movq (%2), %%mm1 \n\t" 170 "movq (%2), %%mm1 \n\t"
230 :"memory");*/ 230 :"memory");*/
231 } 231 }
232 232
233 static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 233 static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
234 { 234 {
235 asm volatile( 235 __asm__ volatile(
236 "testl $1, %0 \n\t" 236 "testl $1, %0 \n\t"
237 " jz 1f \n\t" 237 " jz 1f \n\t"
238 "movd (%1), %%mm0 \n\t" 238 "movd (%1), %%mm0 \n\t"
239 "movd (%2), %%mm1 \n\t" 239 "movd (%2), %%mm1 \n\t"
240 "add %4, %1 \n\t" 240 "add %4, %1 \n\t"
282 } 282 }
283 283
284 284
285 static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 285 static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
286 { 286 {
287 asm volatile( 287 __asm__ volatile(
288 "testl $1, %0 \n\t" 288 "testl $1, %0 \n\t"
289 " jz 1f \n\t" 289 " jz 1f \n\t"
290 "movq (%1), %%mm0 \n\t" 290 "movq (%1), %%mm0 \n\t"
291 "movq (%2), %%mm1 \n\t" 291 "movq (%2), %%mm1 \n\t"
292 "add %4, %1 \n\t" 292 "add %4, %1 \n\t"
337 :"memory");*/ 337 :"memory");*/
338 } 338 }
339 339
340 static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 340 static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
341 { 341 {
342 asm volatile( 342 __asm__ volatile(
343 "lea (%3, %3), %%"REG_a" \n\t" 343 "lea (%3, %3), %%"REG_a" \n\t"
344 "1: \n\t" 344 "1: \n\t"
345 "movq (%1), %%mm0 \n\t" 345 "movq (%1), %%mm0 \n\t"
346 "movq (%1, %3), %%mm1 \n\t" 346 "movq (%1, %3), %%mm1 \n\t"
347 "movq 8(%1), %%mm2 \n\t" 347 "movq 8(%1), %%mm2 \n\t"
377 :"%"REG_a, "memory"); 377 :"%"REG_a, "memory");
378 } 378 }
379 379
380 static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 380 static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
381 { 381 {
382 asm volatile( 382 __asm__ volatile(
383 "testl $1, %0 \n\t" 383 "testl $1, %0 \n\t"
384 " jz 1f \n\t" 384 " jz 1f \n\t"
385 "movq (%1), %%mm0 \n\t" 385 "movq (%1), %%mm0 \n\t"
386 "movq 8(%1), %%mm1 \n\t" 386 "movq 8(%1), %%mm1 \n\t"
387 PAVGB" (%2), %%mm0 \n\t" 387 PAVGB" (%2), %%mm0 \n\t"
425 :"memory");*/ 425 :"memory");*/
426 } 426 }
427 427
428 static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 428 static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
429 { 429 {
430 asm volatile( 430 __asm__ volatile(
431 "testl $1, %0 \n\t" 431 "testl $1, %0 \n\t"
432 " jz 1f \n\t" 432 " jz 1f \n\t"
433 "movq (%1), %%mm0 \n\t" 433 "movq (%1), %%mm0 \n\t"
434 "movq 8(%1), %%mm1 \n\t" 434 "movq 8(%1), %%mm1 \n\t"
435 PAVGB" (%2), %%mm0 \n\t" 435 PAVGB" (%2), %%mm0 \n\t"
479 :"memory");*/ 479 :"memory");*/
480 } 480 }
481 481
482 static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) 482 static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
483 { 483 {
484 asm volatile( 484 __asm__ volatile(
485 "pcmpeqb %%mm6, %%mm6 \n\t" 485 "pcmpeqb %%mm6, %%mm6 \n\t"
486 "testl $1, %0 \n\t" 486 "testl $1, %0 \n\t"
487 " jz 1f \n\t" 487 " jz 1f \n\t"
488 "movq (%1), %%mm0 \n\t" 488 "movq (%1), %%mm0 \n\t"
489 "movq 8(%1), %%mm1 \n\t" 489 "movq 8(%1), %%mm1 \n\t"
554 554
555 /* GL: this function does incorrect rounding if overflow */ 555 /* GL: this function does incorrect rounding if overflow */
556 static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 556 static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
557 { 557 {
558 MOVQ_BONE(mm6); 558 MOVQ_BONE(mm6);
559 asm volatile( 559 __asm__ volatile(
560 "lea (%3, %3), %%"REG_a" \n\t" 560 "lea (%3, %3), %%"REG_a" \n\t"
561 "1: \n\t" 561 "1: \n\t"
562 "movq (%1), %%mm0 \n\t" 562 "movq (%1), %%mm0 \n\t"
563 "movq (%1, %3), %%mm2 \n\t" 563 "movq (%1, %3), %%mm2 \n\t"
564 "movq 1(%1), %%mm1 \n\t" 564 "movq 1(%1), %%mm1 \n\t"
590 :"%"REG_a, "memory"); 590 :"%"REG_a, "memory");
591 } 591 }
592 592
593 static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 593 static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
594 { 594 {
595 asm volatile( 595 __asm__ volatile(
596 "lea (%3, %3), %%"REG_a" \n\t" 596 "lea (%3, %3), %%"REG_a" \n\t"
597 "movq (%1), %%mm0 \n\t" 597 "movq (%1), %%mm0 \n\t"
598 "sub %3, %2 \n\t" 598 "sub %3, %2 \n\t"
599 "1: \n\t" 599 "1: \n\t"
600 "movq (%1, %3), %%mm1 \n\t" 600 "movq (%1, %3), %%mm1 \n\t"
622 622
623 /* GL: this function does incorrect rounding if overflow */ 623 /* GL: this function does incorrect rounding if overflow */
624 static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 624 static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
625 { 625 {
626 MOVQ_BONE(mm6); 626 MOVQ_BONE(mm6);
627 asm volatile( 627 __asm__ volatile(
628 "lea (%3, %3), %%"REG_a" \n\t" 628 "lea (%3, %3), %%"REG_a" \n\t"
629 "movq (%1), %%mm0 \n\t" 629 "movq (%1), %%mm0 \n\t"
630 "sub %3, %2 \n\t" 630 "sub %3, %2 \n\t"
631 "1: \n\t" 631 "1: \n\t"
632 "movq (%1, %3), %%mm1 \n\t" 632 "movq (%1, %3), %%mm1 \n\t"
654 :"%"REG_a, "memory"); 654 :"%"REG_a, "memory");
655 } 655 }
656 656
657 static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 657 static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
658 { 658 {
659 asm volatile( 659 __asm__ volatile(
660 "lea (%3, %3), %%"REG_a" \n\t" 660 "lea (%3, %3), %%"REG_a" \n\t"
661 "1: \n\t" 661 "1: \n\t"
662 "movq (%2), %%mm0 \n\t" 662 "movq (%2), %%mm0 \n\t"
663 "movq (%2, %3), %%mm1 \n\t" 663 "movq (%2, %3), %%mm1 \n\t"
664 PAVGB" (%1), %%mm0 \n\t" 664 PAVGB" (%1), %%mm0 \n\t"
682 :"%"REG_a, "memory"); 682 :"%"REG_a, "memory");
683 } 683 }
684 684
685 static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 685 static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
686 { 686 {
687 asm volatile( 687 __asm__ volatile(
688 "lea (%3, %3), %%"REG_a" \n\t" 688 "lea (%3, %3), %%"REG_a" \n\t"
689 "1: \n\t" 689 "1: \n\t"
690 "movq (%1), %%mm0 \n\t" 690 "movq (%1), %%mm0 \n\t"
691 "movq (%1, %3), %%mm2 \n\t" 691 "movq (%1, %3), %%mm2 \n\t"
692 PAVGB" 1(%1), %%mm0 \n\t" 692 PAVGB" 1(%1), %%mm0 \n\t"
714 :"%"REG_a, "memory"); 714 :"%"REG_a, "memory");
715 } 715 }
716 716
717 static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 717 static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
718 { 718 {
719 asm volatile( 719 __asm__ volatile(
720 "lea (%3, %3), %%"REG_a" \n\t" 720 "lea (%3, %3), %%"REG_a" \n\t"
721 "movq (%1), %%mm0 \n\t" 721 "movq (%1), %%mm0 \n\t"
722 "sub %3, %2 \n\t" 722 "sub %3, %2 \n\t"
723 "1: \n\t" 723 "1: \n\t"
724 "movq (%1, %3), %%mm1 \n\t" 724 "movq (%1, %3), %%mm1 \n\t"
755 /* Note this is not correctly rounded, but this function is only 755 /* Note this is not correctly rounded, but this function is only
756 * used for B-frames so it does not matter. */ 756 * used for B-frames so it does not matter. */
757 static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 757 static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
758 { 758 {
759 MOVQ_BONE(mm6); 759 MOVQ_BONE(mm6);
760 asm volatile( 760 __asm__ volatile(
761 "lea (%3, %3), %%"REG_a" \n\t" 761 "lea (%3, %3), %%"REG_a" \n\t"
762 "movq (%1), %%mm0 \n\t" 762 "movq (%1), %%mm0 \n\t"
763 PAVGB" 1(%1), %%mm0 \n\t" 763 PAVGB" 1(%1), %%mm0 \n\t"
764 ASMALIGN(3) 764 ASMALIGN(3)
765 "1: \n\t" 765 "1: \n\t"
796 } 796 }
797 797
798 static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h) 798 static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
799 { 799 {
800 do { 800 do {
801 asm volatile( 801 __asm__ volatile(
802 "movd (%1), %%mm0 \n\t" 802 "movd (%1), %%mm0 \n\t"
803 "movd (%1, %2), %%mm1 \n\t" 803 "movd (%1, %2), %%mm1 \n\t"
804 "movd (%1, %2, 2), %%mm2 \n\t" 804 "movd (%1, %2, 2), %%mm2 \n\t"
805 "movd (%1, %3), %%mm3 \n\t" 805 "movd (%1, %3), %%mm3 \n\t"
806 PAVGB" (%0), %%mm0 \n\t" 806 PAVGB" (%0), %%mm0 \n\t"
850 DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h); 850 DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
851 } 851 }
852 852
853 #define QPEL_2TAP_L3(OPNAME) \ 853 #define QPEL_2TAP_L3(OPNAME) \
854 static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\ 854 static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
855 asm volatile(\ 855 __asm__ volatile(\
856 "1: \n\t"\ 856 "1: \n\t"\
857 "movq (%1,%2), %%mm0 \n\t"\ 857 "movq (%1,%2), %%mm0 \n\t"\
858 "movq 8(%1,%2), %%mm1 \n\t"\ 858 "movq 8(%1,%2), %%mm1 \n\t"\
859 PAVGB" (%1,%3), %%mm0 \n\t"\ 859 PAVGB" (%1,%3), %%mm0 \n\t"\
860 PAVGB" 8(%1,%3), %%mm1 \n\t"\ 860 PAVGB" 8(%1,%3), %%mm1 \n\t"\
872 "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\ 872 "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
873 :"memory"\ 873 :"memory"\
874 );\ 874 );\
875 }\ 875 }\
876 static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\ 876 static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
877 asm volatile(\ 877 __asm__ volatile(\
878 "1: \n\t"\ 878 "1: \n\t"\
879 "movq (%1,%2), %%mm0 \n\t"\ 879 "movq (%1,%2), %%mm0 \n\t"\
880 PAVGB" (%1,%3), %%mm0 \n\t"\ 880 PAVGB" (%1,%3), %%mm0 \n\t"\
881 PAVGB" (%1), %%mm0 \n\t"\ 881 PAVGB" (%1), %%mm0 \n\t"\
882 STORE_OP((%1,%4),%%mm0)\ 882 STORE_OP((%1,%4),%%mm0)\