[MPlayer-dev-eng] [PATCH] fix mp3lib/tabinit_MMX.c asm code

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Nov 19 16:49:02 CET 2006


Hello,
it currently contains code like
       "fstps %1+64(,%%ecx,4)\n\t"
which might end up in the final asm as something like
fstps (%eax)+64(,%ecx,4)
which obviously will not work.
Since MANGLE is already used in one other place, I suggest replacing
these %1 all by MANGLE(mp3lib_decwin)/MANGLE(mp3lib_decwins), like
attached patch does.
Comments?

Greetings,
Reimar Döffinger

P.S.: Hints how to make git-diff/cg-diff not add that a/ and b/ before
the paths in the diff are welcome, too.
-------------- next part --------------
diff --git a/mp3lib/tabinit_MMX.c b/mp3lib/tabinit_MMX.c
index 854846d..26326db 100644
--- a/mp3lib/tabinit_MMX.c
+++ b/mp3lib/tabinit_MMX.c
@@ -73,9 +73,9 @@ void make_decode_tables_MMX(long scaleva
 	"fildl (%%esp)\n\t"
 	"fdivs "MANGLE(intwindiv)"\n\t"
 	"popl %%eax\n\t"
-	"fimull %2\n\t"
-	"fsts  %1(,%%ecx,4)\n\t"
-	"fstps %1+64(,%%ecx,4)\n\t"
+	"fimull %1\n\t"
+	"fsts  "MANGLE(mp3lib_decwin)"(,%%ecx,4)\n\t"
+	"fstps "MANGLE(mp3lib_decwin)"+64(,%%ecx,4)\n\t"
 ".L02:\n\t"
 	"leal -1(%%esi),%%edx\n\t"
 	"and %%ebx,%%edx\n\t"
@@ -84,19 +84,19 @@ void make_decode_tables_MMX(long scaleva
 	"addl $-1023,%%ecx\n\t"
 	"test %%esi,%%ebx\n\t"
 	"jz  .L03\n\t"
-	"negl %2\n\t"
+	"negl %1\n\t"
 ".L03:\n\t"
 	"addl %%esi,%%ecx\n\t"
-	"addl %3,%%edi\n\t"
+	"addl %2,%%edi\n\t"
 	"incl %%ebx\n\t"
 	"cmpl %0,%%edi\n\t"
 	"jz .L04\n\t"
 	"cmp $256,%%ebx\n\t"
 	"jnz .L00\n\t"
-	"negl %3\n\t"
+	"negl %2\n\t"
 	"jmp .L00\n\t"
 ".L04:\n\t"
-	::"g"(intwinbase_MMX),"m"(mp3lib_decwin[0]),"m"(scaleval),"m"(intwinbase_step)
+	::"g"(intwinbase_MMX),"m"(scaleval),"m"(intwinbase_step)
 	:"memory","%eax","%ebx","%ecx","%edx","%esi","%edi");
 intwinbase_step=2;
   __asm __volatile(
@@ -111,7 +111,7 @@ intwinbase_step=2;
 	"addl $60000,%%eax\n\t"
 ".L06:\n\t"
 	"cltd\n\t"
-	"imull %2\n\t"
+	"imull %1\n\t"
 	"shrdl $17,%%edx,%%eax\n\t"
 	"cmpl $32767,%%eax\n\t"
 	"movl $1055,%%edx\n\t"
@@ -126,15 +126,15 @@ intwinbase_step=2;
 	"cmpl $512,%%ecx\n\t"
 	"jnc .L09\n\t"
 	"subl %%ecx,%%edx\n\t"
-	"movw %%ax,%1(,%%edx,2)\n\t"
-	"movw %%ax,%1-32(,%%edx,2)\n\t"
+	"movw %%ax,"MANGLE(mp3lib_decwins)"(,%%edx,2)\n\t"
+	"movw %%ax,"MANGLE(mp3lib_decwins)"-32(,%%edx,2)\n\t"
 ".L09:\n\t"
 	"testl $1,%%ecx\n\t"
 	"jnz .L10\n\t"
 	"negl %%eax\n\t"
 ".L10:\n\t"
-	"movw %%ax,%1(,%%ecx,2)\n\t"
-	"movw %%ax,%1+32(,%%ecx,2)\n\t"
+	"movw %%ax,"MANGLE(mp3lib_decwins)"(,%%ecx,2)\n\t"
+	"movw %%ax,"MANGLE(mp3lib_decwins)"+32(,%%ecx,2)\n\t"
 ".L11:\n\t"
 	"leal -1(%%esi),%%edx\n\t"
 	"and %%ebx,%%edx\n\t"
@@ -143,18 +143,18 @@ intwinbase_step=2;
 	"addl $-1023,%%ecx\n\t"
 	"test %%esi,%%ebx\n\t"
 	"jz  .L12\n\t"
-	"negl %2\n\t"
+	"negl %1\n\t"
 ".L12:\n\t"
 	"addl %%esi,%%ecx\n\t"
-	"addl %3,%%edi\n\t"
+	"addl %2,%%edi\n\t"
 	"incl %%ebx\n\t"
 	"cmpl %0,%%edi\n\t"
 	"jz .L13\n\t"
 	"cmp $256,%%ebx\n\t"
 	"jnz .L05\n\t"
-	"negl %3\n\t"
+	"negl %2\n\t"
 	"jmp .L05\n\t"
 ".L13:\n\t"
-	::"g"(intwinbase_MMX),"m"(mp3lib_decwins[0]),"m"(scaleval),"m"(intwinbase_step)
+	::"g"(intwinbase_MMX),"m"(scaleval),"m"(intwinbase_step)
 	:"memory","%eax","%ebx","%ecx","%edx","%esi","%edi");
 }


More information about the MPlayer-dev-eng mailing list