diff options
author | Wincent Balin <wincent@rockbox.org> | 2010-06-04 18:21:47 +0000 |
---|---|---|
committer | Wincent Balin <wincent@rockbox.org> | 2010-06-04 18:21:47 +0000 |
commit | d166d61b09e40a010c8a3b98b40b8b075e5af463 (patch) | |
tree | c2ebe3e1211fbb6176e9bedb6957cc63a5c2f08a /apps/plugins | |
parent | 2464eaeba16819017072fd0739bb770e22a92b73 (diff) |
pdbox: Added Coldfire multiplication optimization by Buschel.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26550 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/m_fixed.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/apps/plugins/pdbox/PDa/src/m_fixed.h b/apps/plugins/pdbox/PDa/src/m_fixed.h index 2a89a18b5a..d46299efe6 100644 --- a/apps/plugins/pdbox/PDa/src/m_fixed.h +++ b/apps/plugins/pdbox/PDa/src/m_fixed.h @@ -16,7 +16,8 @@ typedef int t_sample; /* fixed point multiplication and division */ -#if defined(ROCKBOX) && defined(CPU_ARM) +#ifdef ROCKBOX +#if defined(CPU_ARM) #define mult(A,B) \ ({ \ t_fixed lo; \ @@ -30,10 +31,28 @@ typedef int t_sample; lo; \ }) #define idiv(a,b) ((((long long) (a) )<<fix1)/(long long) (b) ) -#else /* ROCKBOX && CPU_ARM */ +#elif defined(CPU_COLDFIRE) +#define mult(a,b) mult_cf((a),(b)) +static inline t_fixed mult_cf(t_fixed x, t_fixed y) +{ + t_fixed t1, t2; + asm volatile ( + "mac.l %[x],%[y],%%acc0 \n" /* multiply */ + "mulu.l %[y],%[x] \n" /* get low half, avoid emac stall */ + "movclr.l %%acc0,%[t1] \n" /* get higher half */ + "asl.l %[shl],%[t1] \n" /* hi <<= 13, plus one free */ + "lsr.l %[shr],%[x] \n" /* (unsigned)lo >>= 18 */ + "or.l %[x],%[t1] \n" /* combine result */ + : [t1]"=&d"(t1), [t2]"=&d"(t2), [x]"+d"(x) + : [y]"d"(y), [shl]"d"(31-fix1), [shr]"d"(fix1)); + return t1; +} +#define idiv(a,b) ((((long long) (a) )<<fix1)/(long long) (b) ) +#endif /* CPU_... */ +#else /* ROCKBOX */ #define mult(a,b) (long long)(((long long) (a) * (long long) (b))>>fix1) #define idiv(a,b) ((((long long) (a) )<<fix1)/(long long) (b) ) -#endif /* ROCKBOX && CPU_ARM */ +#endif /* ROCKBOX */ /* conversion macros */ |