From c2bd876e89e39fe0639cd60a1092841dd778c61f Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Thu, 22 Sep 2011 17:32:02 +0000 Subject: libtremor: cf asm for ff_vector_fmul_window_c, gives a speedup of ~0.3MHz. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30582 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libtremor/asm_mcf5249.h | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'apps/codecs/libtremor/asm_mcf5249.h') diff --git a/apps/codecs/libtremor/asm_mcf5249.h b/apps/codecs/libtremor/asm_mcf5249.h index 66de07615f..38aa117d84 100644 --- a/apps/codecs/libtremor/asm_mcf5249.h +++ b/apps/codecs/libtremor/asm_mcf5249.h @@ -26,6 +26,59 @@ #ifndef _V_WIDE_MATH #define _V_WIDE_MATH +#define INCL_OPTIMIZED_VECTOR_FMUL_WINDOW +static inline void ff_vector_fmul_window_c(ogg_int32_t *dst, const ogg_int32_t *src0, + const ogg_int32_t *src1, const ogg_int32_t *win, int len) +{ + /* len is always a power of 2 and always >= 16 so this is unrolled 4 times*/ + ogg_int32_t *dst0 = dst, *dst1 = dst + 2*len; + const ogg_int32_t *win0 = win, *win1 = win + 2*len; + src1 += len; + asm volatile ("move.l (%[src0])+, %%d0\n\t" + "move.l -(%[win1]), %%d3\n\t" + "tst.l %[len]\n\t" + "bra.s 1f\n\t" + "0:\n\t" + "mac.l %%d0, %%d3, (%[win0])+, %%d2, %%acc0\n\t" + "mac.l %%d0, %%d2, -(%[src1]), %%d1, %%acc1\n\t" + "msac.l %%d1, %%d2, (%[src0])+, %%d0, %%acc0\n\t" + "mac.l %%d1, %%d3, -(%[win1]), %%d3, %%acc1\n\t" + "mac.l %%d0, %%d3, (%[win0])+, %%d2, %%acc2\n\t" + "mac.l %%d0, %%d2, -(%[src1]), %%d1, %%acc3\n\t" + "msac.l %%d1, %%d2, (%[src0])+, %%d0, %%acc2\n\t" + "mac.l %%d1, %%d3, -(%[win1]), %%d3, %%acc3\n\t" + "movclr.l %%acc0, %%d1\n\t" + "movclr.l %%acc2, %%d2\n\t" + "subq.l #8, %[dst1]\n\t" + "movclr.l %%acc1, %%d5\n\t" + "movclr.l %%acc3, %%d4\n\t" + "movem.l %%d4-%%d5, (%[dst1])\n\t" + "mac.l %%d0, %%d3, (%[win0])+, %%d5, %%acc0\n\t" + "mac.l %%d0, %%d5, -(%[src1]), %%d4, %%acc1\n\t" + "msac.l %%d4, %%d5, (%[src0])+, %%d0, %%acc0\n\t" + "mac.l %%d4, %%d3, -(%[win1]), %%d3, %%acc1\n\t" + "mac.l %%d0, %%d3, (%[win0])+, %%d5, %%acc2\n\t" + "mac.l %%d0, %%d5, -(%[src1]), %%d4, %%acc3\n\t" + "msac.l %%d4, %%d5, (%[src0])+, %%d0, %%acc2\n\t" /* will read one past end of src0 */ + "mac.l %%d4, %%d3, -(%[win1]), %%d3, %%acc3\n\t" /* will read one into win0 */ + "movclr.l %%acc0, %%d4\n\t" + "movclr.l %%acc2, %%d5\n\t" + "movem.l %%d1-%%d2/%%d4-%%d5, (%[dst0])\n\t" + "lea (16, %[dst0]), %[dst0]\n\t" + "subq.l #8, %[dst1]\n\t" + "movclr.l %%acc1, %%d2\n\t" + "movclr.l %%acc3, %%d1\n\t" + "movem.l %%d1-%%d2, (%[dst1])\n\t" + "subq.l #4, %[len]\n\t" + "1:\n\t" + "bgt.s 0b\n\t" + : [dst0] "+a" (dst0), [dst1] "+a" (dst1), + [src0] "+a" (src0), [src1] "+a" (src1), + [win0] "+a" (win0), [win1] "+a" (win1), + [len] "+d" (len) + :: "d0", "d1", "d2", "d3", "d4", "d5", "cc", "memory" ); +} + #define MB() #endif -- cgit v1.2.3