[FFmpeg-devel] [Ffmpeg-devel] [PATCH] detect support for 10 operands in configure

Loren Merritt lorenm
Sun Feb 22 03:12:06 CET 2009


On Sat, 21 Feb 2009, Diego Biurrun wrote:
> On Sat, Feb 14, 2009 at 03:09:16AM +0100, Diego Biurrun wrote:
>>
>> Ooops, I indeed forgot about that.  After putting r5962 of fft_3dn2.c in
>> place I tried compiling with gcc 4.1, 3.4, 3.3 and 2.95.  After changing
>> asm to __asm__ and adjusting the function declaratin in dsputil.h it
>> compiles fine with gcc 4.1, 3.4 and 3.3.  Only 2.95 fails and outputs
>> the following error message:
>>
>> libavcodec/x86/fft_3dn2.c: In function `ff_imdct_calc_3dn2':
>> libavcodec/x86/fft_3dn2.c:214: Invalid `asm' statement:
>> libavcodec/x86/fft_3dn2.c:214: fixed or forbidden register 7 (sp) was spilled for class GENERAL_REGS.
>>
>> I'm sure we could add a check for this to configure.
>
> Loren, what do you think?

Since it's not a lack of a feature but rather a failure of optimization, 
I guess you'd have to paste exactly the same asm constraints into 
configure and hope the context doesn't affect it.

> Also note that merging back the code from r5964 is nontrivial for me
> since I know zilch about x86 asm while you can probably do it in two
> minutes or so...

attached

--Loren Merritt
-------------- next part --------------
Index: libavcodec/x86/fft_3dn2.c
===================================================================
--- libavcodec/x86/fft_3dn2.c	(revision 17512)
+++ libavcodec/x86/fft_3dn2.c	(working copy)
@@ -72,12 +72,11 @@
     __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
 #endif
     for(k = 0; k < n4; k++) {
-        // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
         __asm__ volatile(
-            "movd         %0, %%mm0 \n"
-            "movd         %2, %%mm1 \n"
-            "punpckldq    %1, %%mm0 \n"
-            "punpckldq    %3, %%mm1 \n"
+            "movd         %1, %%mm0 \n"
+            "movd         %3, %%mm1 \n"
+            "punpckldq    %2, %%mm0 \n"
+            "punpckldq    %4, %%mm1 \n"
             "movq      %%mm0, %%mm2 \n"
             PSWAPD(    %%mm1, %%mm3 )
             "pfmul     %%mm1, %%mm0 \n"
@@ -91,12 +90,10 @@
 #else
             "pfpnacc   %%mm2, %%mm0 \n"
 #endif
-            ::"m"(in2[-2*k]), "m"(in1[2*k]),
-              "m"(tcos[k]), "m"(tsin[k])
-        );
-        __asm__ volatile(
-            "movq    %%mm0, %0    \n\t"
+            "movq      %%mm0, %0    \n"
             :"=m"(z[revtab[k]])
+            :"m"(in2[-2*k]), "m"(in1[2*k]),
+             "m"(tcos[k]), "m"(tsin[k])
         );
     }
 



More information about the ffmpeg-devel mailing list