[FFmpeg-devel] [RFC] fix lpc_mmx.c compilation with --enable-pic

Reimar Döffinger Reimar.Doeffinger
Sun Nov 22 11:36:01 CET 2009


Hello,
unfortunately gcc is as usual quite stupid so a constraint like
"=m"(autoc[j]), "=m"(autoc[j+1]), "=m"(autoc[j+2]) takes up a lot of
registers (strangely this also causes all other asm in the same function
to fail with "out of registers", including any asm from inlined
functions).
Attached is a possible solution I found which seems reasonable to me.
Comments?
-------------- next part --------------
Index: libavcodec/x86/lpc_mmx.c
===================================================================
--- libavcodec/x86/lpc_mmx.c	(revision 20575)
+++ libavcodec/x86/lpc_mmx.c	(working copy)
@@ -89,12 +89,12 @@
                 "movsd    "MANGLE(ff_pd_1)", %%xmm1 \n\t"
                 "movsd    "MANGLE(ff_pd_1)", %%xmm2 \n\t"
                 "1:                                 \n\t"
-                "movapd   (%4,%0), %%xmm3           \n\t"
-                "movupd -8(%5,%0), %%xmm4           \n\t"
-                "movapd   (%5,%0), %%xmm5           \n\t"
+                "movapd   (%2,%0), %%xmm3           \n\t"
+                "movupd -8(%3,%0), %%xmm4           \n\t"
+                "movapd   (%3,%0), %%xmm5           \n\t"
                 "mulpd     %%xmm3, %%xmm4           \n\t"
                 "mulpd     %%xmm3, %%xmm5           \n\t"
-                "mulpd -16(%5,%0), %%xmm3           \n\t"
+                "mulpd -16(%3,%0), %%xmm3           \n\t"
                 "addpd     %%xmm4, %%xmm1           \n\t"
                 "addpd     %%xmm5, %%xmm0           \n\t"
                 "addpd     %%xmm3, %%xmm2           \n\t"
@@ -106,11 +106,12 @@
                 "addsd     %%xmm3, %%xmm0           \n\t"
                 "addsd     %%xmm4, %%xmm1           \n\t"
                 "addsd     %%xmm5, %%xmm2           \n\t"
-                "movsd     %%xmm0, %1               \n\t"
-                "movsd     %%xmm1, %2               \n\t"
-                "movsd     %%xmm2, %3               \n\t"
-                :"+&r"(i), "=m"(autoc[j]), "=m"(autoc[j+1]), "=m"(autoc[j+2])
-                :"r"(data1+len), "r"(data1+len-j)
+                "movsd     %%xmm0,   (%1)           \n\t"
+                "movsd     %%xmm1,  8(%1)           \n\t"
+                "movsd     %%xmm2, 16(%1)           \n\t"
+                :"+&r"(i)
+                :"r"(autoc+j), "r"(data1+len), "r"(data1+len-j)
+                :"memory"
             );
         } else {
             __asm__ volatile(



More information about the ffmpeg-devel mailing list