From 17069799a935fc96367b7cfd7d5e3ec689bcef92 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Wed, 28 Jul 2010 20:46:51 +0000 Subject: Refactor asm macros in libwmapro's vector_fixmul_() functions. No change to output samples. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27604 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwmapro/wmapro_math.h | 108 +++++++++++++++--------------------- 1 file changed, 46 insertions(+), 62 deletions(-) (limited to 'apps/codecs') diff --git a/apps/codecs/libwmapro/wmapro_math.h b/apps/codecs/libwmapro/wmapro_math.h index c94fa80271..3672c0103b 100644 --- a/apps/codecs/libwmapro/wmapro_math.h +++ b/apps/codecs/libwmapro/wmapro_math.h @@ -181,35 +181,26 @@ #endif /* CPU_COLDFIRE, CPU_ARM */ #if defined(CPU_COLDFIRE) -static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, - const int32_t *src1, const int32_t *win, - int len) -{ - int i, j; - dst += len; - win += len; - src0+= len; - for(i=-len, j=len-1; i<0; i++, j--) { - int32_t s0 = src0[i]; - int32_t s1 = src1[j]; - int32_t wi = -win[i]; - int32_t wj = -win[j]; - asm volatile ( - "mac.l %[s0], %[wj], %%acc0\n\t" - "msac.l %[s1], %[wi], %%acc0\n\t" - "mac.l %[s0], %[wi], %%acc1\n\t" - "mac.l %[s1], %[wj], %%acc1\n\t" - "movclr.l %%acc0, %[s0]\n\t" - "move.l %[s0], (%[dst_i])\n\t" - "movclr.l %%acc1, %[s0]\n\t" - "move.l %[s0], (%[dst_j])\n\t" - : [s0] "+r" (s0) /* this register is clobbered so specify it as an input */ - : [dst_i] "a" (&dst[i]), [dst_j] "a" (&dst[j]), - [s1] "r" (s1), [wi] "r" (wi), [wj] "r" (wj) - : "cc", "memory"); - } -} + #define VECT_MUL_WIN_KERNEL(i, j, s0, s1, wi, wj) \ + asm volatile ( \ + "mac.l %[s0], %[wj], %%acc0 \n\t" \ + "msac.l %[s1], %[wi], %%acc0 \n\t" \ + "mac.l %[s0], %[wi], %%acc1 \n\t" \ + "mac.l %[s1], %[wj], %%acc1 \n\t" \ + "movclr.l %%acc0, %[s0] \n\t" \ + "move.l %[s0], (%[dst_i]) \n\t" \ + "movclr.l %%acc1, %[s0] \n\t" \ + "move.l %[s0], (%[dst_j]) \n\t" \ + : [s0] "+r" (s0) /* register is clobbered so specify it as an input */ \ + : [dst_i] "a" (&dst[i]), [dst_j] "a" (&dst[j]), \ + [s1] "r" (s1), [wi] "r" (wi), [wj] "r" (wj) \ + : "cc", "memory"); #else + #define VECT_MUL_WIN_KERNEL(i, j, s0, s1, wi, wj) \ + dst[i] = fixmul31(s0, wj) - fixmul31(s1, wi); \ + dst[j] = fixmul31(s0, wi) + fixmul31(s1, wj); +#endif /* CPU_COLDFIRE */ + static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, const int32_t *src1, const int32_t *win, int len) @@ -223,41 +214,38 @@ static inline void vector_fixmul_window(int32_t *dst, const int32_t *src0, int32_t s1 = src1[j]; /* s1 = src1[2*len-1 ... len] */ int32_t wi = -win[i]; /* wi = -win[ 0 ... len-1] */ int32_t wj = -win[j]; /* wj = -win[2*len-1 ... len] */ - dst[i] = fixmul31(s0, wj) - fixmul31(s1, wi); /* dst[ 0 ... len-1] */ - dst[j] = fixmul31(s0, wi) + fixmul31(s1, wj); /* dst[2*len-1 ... len] */ + VECT_MUL_WIN_KERNEL(i, j, s0, s1, wi, wj); } } -#endif #if defined(CPU_ARM) -static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src, - int32_t mul, int len) -{ - /* len is _always_ a multiple of 4, because len is the difference of sfb's - * which themselves are always a multiple of 4. */ - int i; - for (i=0; i