[Ffmpeg-devel] Still struggling with -fPIC and MMX asm-code

Michael Niedermayer michaelni
Thu Jul 14 23:01:10 CEST 2005


Hi

On Thursday 14 July 2005 22:20, Tobias Grimm wrote:
> Hi!
>
> I'm still struggling with the asm blocks, trying to make the code
> compile with -fPIC. I need to split these asm blocks in order to use
> less registers for the operands. But I think, I'm doing something
> completely wrong, maybe anyone here can help me?
>
[...]
> And that's how I thought this can be splitted into two asm-blocks, Bit
> it simply doesn't work anymore with this change, What am I doing wrong?
>
> asm volatile(
>     "movd %%"REG_a", %%mm3        \n\t" // last_non_zero_p1
>     SPREADW(%%mm3)
>     "pxor %%mm7, %%mm7            \n\t" // 0
>     "pxor %%mm4, %%mm4            \n\t" // 0
>     "mov $-128, %%"REG_a"         \n\t"
>     ".balign 16                   \n\t"
>     "1:                           \n\t"
>     "pxor %%mm1, %%mm1            \n\t" // 0
>     "movq (%0, %%"REG_a"), %%mm0  \n\t" // block[i]
>     "pcmpgtw %%mm0, %%mm1         \n\t" // block[i] <= 0 ? 0xFF : 0x00
>     "pxor %%mm1, %%mm0            \n\t"
>     "psubw %%mm1, %%mm0           \n\t" // ABS(block[i])
>     "movq (%1, %%"REG_a"), %%mm6  \n\t" // bias[0]
>     "paddusw %%mm6, %%mm0         \n\t" // ABS(block[i]) + bias[0]
>
>     :: "r" (block+64), "r" (bias+64)
>
> );

as REG_a (eax/rax) is changed it must be an output operand or on the clobber 
list
you also cannot safely jump between asm blocks unless you take MANY 
precautions (= forget it)

[...]
-- 
Michael





More information about the ffmpeg-devel mailing list