[FFmpeg-devel] [PATCH] Altivec split-radix FFT

Guillaume POIRIER poirierg
Wed Aug 26 22:54:22 CEST 2009


Hey,

On Wed, Aug 26, 2009 at 12:07 AM, Guillaume POIRIER<poirierg at gmail.com> wrote:
>
> Your ASM looks OK at first look, but there's smth wrong about it that
> doesn't make it PPC64-compatible:
>
> Starting program: /home/guillaume/ffmpeg-svn/libavcodec/fft-test
> FFT 512 test
> Checking...
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x1001115800000000 in ?? ()
> (gdb) up
> #1 ?0x00000000100107d0 in .ff_fft_calc_altivec ()
> (gdb) disassemble $pc-32 $pc+32
> Dump of assembler code from 0x100107b0 to 0x100107f0:
> 0x00000000100107b0 <.ff_fft_calc_altivec+524>: ?ld ? ? ?r9,-31728(r2)
> 0x00000000100107b4 <.ff_fft_calc_altivec+528>: ?rldicr ?r0,r0,3,60
> 0x00000000100107b8 <.ff_fft_calc_altivec+532>: ?add ? ? r9,r9,r0
> 0x00000000100107bc <.ff_fft_calc_altivec+536>: ?ld ? ? ?r11,0(r9)
> 0x00000000100107c0 <.ff_fft_calc_altivec+540>: ?mtctr ? r11
> 0x00000000100107c4 <.ff_fft_calc_altivec+544>: ?stw ? ? r2,-4(r1)
> 0x00000000100107c8 <.ff_fft_calc_altivec+548>: ?li ? ? ?r2,16
> 0x00000000100107cc <.ff_fft_calc_altivec+552>: ?bctrl
> 0x00000000100107d0 <.ff_fft_calc_altivec+556>: ?lwz ? ? r2,-4(r1)
> 0x00000000100107d4 <.ff_fft_calc_altivec+560>: ?ld ? ? ?r9,608(r31)
> 0x00000000100107d8 <.ff_fft_calc_altivec+564>: ?lwz ? ? r0,0(r9)
> 0x00000000100107dc <.ff_fft_calc_altivec+568>: ?extsw ? r0,r0
> 0x00000000100107e0 <.ff_fft_calc_altivec+572>: ?cmpwi ? cr7,r0,4
> 0x00000000100107e4 <.ff_fft_calc_altivec+576>: ?bgt- ? ?cr7,0x10010810
> <.ff_fft_calc_altivec+620>
> 0x00000000100107e8 <.ff_fft_calc_altivec+580>: ?ld ? ? ?r11,616(r31)
> 0x00000000100107ec <.ff_fft_calc_altivec+584>: ?ld ? ? ?r9,608(r31)
> End of assembler dump.
> (gdb) print $r2
> $1 = 16
> (gdb) print $r1
> $2 = 17359809783712
>
> I need to look into this. I've never ported code to PPC64, so now's a
> good time to start...

There's really little information about inline asm PPC64 programming.
So far, it looks like PPC64 is exactly the same thing as PPC32, except
that it allows 64-bits pointers.

The previous error I reported was on Linux/PPC64, where your code was
compiling/assembling OK, but not running.
I tried fix that problem on my local OSXLepoard/PPC, and in fact, your
code doesn't assemble with that toolchain. That can't be good.

This is the relevant part of your code (from ff_fft_calc_altivec() function)
:

+        "mtctr %0 \n"
+        "stw 2,-4(1) \n"
+        "li 2,16 \n"
+        "bctrl \n"
+        "lwz 2,-4(1) \n" // ABI docs say r2 is general purpose and
caller-saved, but gcc doesn't save it and crashes

Which translates into:
L214: mtctr r11
L215: stw 2,-4(1)
L216: li 2,16
L217: bctrl
L218: lwz 2,-4(1)

The error message is:
libavcodec/ppc/fft_altivec.S:215:Parameter syntax error (parameter 1)
libavcodec/ppc/fft_altivec.S:216:Parameter syntax error (parameter 1)
libavcodec/ppc/fft_altivec.S:218:Parameter syntax error (parameter 1)

I honestly don't understand what's wrong with what you wrote. OSX
toolchain doesn't like that code neither for PPC32  nor PPC64 target.

I guess I have many more things to learn about that in the following days...

Guillaume
-- 
Only a very small fraction of our DNA does anything; the rest is all
comments and ifdefs.

Charles de Gaulle  - "The better I get to know men, the more I find
myself loving dogs." -
http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html



More information about the ffmpeg-devel mailing list