On Fri, 18 Sep 2009, M?ns Rullg?rd wrote:
On Fri, 18 Sep 2009, Loren Merritt wrote:
Now without Apple workarounds.
diff --git a/configure b/configure index 6aa6177..fdb6ade 100755 --- a/configure +++ b/configure @@ -933,6 +933,7 @@ HAVE_LIST=" fast_cmov fast_unaligned fork + fsf_gas gethrtime GetProcessTimes getrusage @@ -2108,6 +2109,7 @@ elif enabled mips; then elif enabled ppc; then
check_asm dcbzl '"dcbzl 0, 1"' + check_asm fsf_gas '"add 0, 0, 0"' check_asm ppc4xx '"maclhw r10, r11, r12"' check_asm xform_asm '"lwzx 0, %y0" :: "Z"(*(int*)0)'
This is the syntax the IBM PPC documentation uses, so branding it fsf seems a bit wrong.
changed.
diff --git a/libavcodec/fft.c b/libavcodec/fft.c index c827139..52bc73a 100644 --- a/libavcodec/fft.c +++ b/libavcodec/fft.c @@ -89,7 +89,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) s->split_radix = 1;
if (ARCH_ARM) ff_fft_init_arm(s); - if (HAVE_ALTIVEC) ff_fft_init_altivec(s); + if (HAVE_ALTIVEC && HAVE_FSF_GAS) ff_fft_init_altivec(s); if (HAVE_MMX) ff_fft_init_mmx(s);
if (s->split_radix) {
I'd rather hide this condition inside ff_fft_init_altivec().
changed.
diff --git a/libavcodec/ppc/fft_altivec.c b/libavcodec/ppc/fft_altivec.c index 83b2b7f..235f205 100644 --- a/libavcodec/ppc/fft_altivec.c +++ b/libavcodec/ppc/fft_altivec.c [...] +extern FFTSample ff_cos_16[];
Isn't this declared in some header file? If not, it should be.
+// pointers to functions. but unlike function pointers on some PPC ABIs, these aren't function descriptors.
What does that mean? Not saying it's wrong, I just don't understand it.
<malc> ff_fft_dispatch_altivec[s->nbits-2] forces gcc to assume it's TOC and lead to funny results such as the one guys on the ML have mentioned. <malc> the table should be declared as one just containing plain pointers (void * for instance) so that the compiler wont try to be smart about it. <pengvado> function points are different from normal pointers on ppc? <malc> on AIX PPC32 and PPC64 (any ABI) those point to function descriptor. <malc> which is basically a pair of function address and a TOC corresponding to said function. <malc> same is true for IA64 i think.
s->fft_permute = ff_fft_permute_c; s->fft_calc = ff_fft_calc_c; s->imdct_calc = ff_imdct_calc_c; s->imdct_half = ff_imdct_half_c; - s->mdct_calc = ff_mdct_calc_c;
I think that line should stay.
changed.
+static void ff_imdct_half_altivec(MDCTContext *s, FFTSample *output, const FFTSample *input) +{ + int j, k; + int n = 1 << s->nbits; + int n4 = n >> 2; + int n8 = n >> 3; + int n32 = n >> 5; + const uint16_t *revtabj = s->fft.revtab; + const uint16_t *revtabk = s->fft.revtab+n4; + const vec_f *tcos = (const vec_f*)(s->tcos+n8); + const vec_f *tsin = (const vec_f*)(s->tsin+n8); + const vec_f *pin = (const vec_f*)(input+n4); + vec_f *pout = (vec_f*)(output+n4);
Why the intrinsics here?
Because gcc doesn't screw it up. I tried an asm version, but it's 100 lines longer and not at all faster. --Loren Merritt