[FFmpeg-devel] [gcc-trunk] swscale_template.c:1358:1: error: bp cannot be used in asm here

Reimar Döffinger Reimar.Doeffinger
Wed Oct 21 08:34:38 CEST 2009


On Tue, Oct 20, 2009 at 11:22:35PM -0200, Ramiro Polla wrote:
>  #if ARCH_X86_64
>                  __asm__ volatile(
> -                    YSCALEYUV2RGB(%%REGBP, %5)
> -                    YSCALEYUV2RGB_YA(%%REGBP, %5, %6, %7)
> +                    YSCALEYUV2RGB(%%REGb, %5)
> +                    YSCALEYUV2RGB_YA(%%REGb, %5, %6, %7)
>                      "psraw                  $3, %%mm1       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
>                      "psraw                  $3, %%mm7       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
>                      "packuswb            %%mm7, %%mm1       \n\t"
> -                    WRITEBGR32(%4, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
> +                    WRITEBGR32(%4, 8280(%5), %%REGb, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
>  
>                      :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "r" (dest),
>                      "a" (&c->redDither)
>                      ,"r" (abuf0), "r" (abuf1)
> -                    : "%"REG_BP
> +                    : "%"REG_b

This is 64-bit specific so there are enough registers available, and the REG_ indirection
is not really necessary.
But most importantly, switching from the second-most problematic register (BP) to the most
problematic (BX) sure is not an improvement, particularly if the code does not check it
is available.
Try using r8 or something like that.
_Ideally_ it should be benchmarked since r8 might be callee-saved (I don't remember),
though I doubt it really matters.



More information about the ffmpeg-devel mailing list