summaryrefslogtreecommitdiffstats
path: root/apps/plugins/fractals/cpu_coldfire.h
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-01-17 22:03:36 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-01-17 22:03:36 +0000
commit563f2602f471208cb8544a36539a79dcceaad643 (patch)
tree0d78bda3fcd3ee085b2be88b9eba9255e22f4e6c /apps/plugins/fractals/cpu_coldfire.h
parentd8123629058c534835058f2db94ba1c2636408e2 (diff)
downloadrockbox-563f2602f471208cb8544a36539a79dcceaad643.tar.gz
rockbox-563f2602f471208cb8544a36539a79dcceaad643.tar.bz2
rockbox-563f2602f471208cb8544a36539a79dcceaad643.zip
Fractals: Have helper functions in header file to keep them inlined
- Should fix performance degradation caused because of the split - Thanks for all who noticed (amiconn et al.) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24266 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/fractals/cpu_coldfire.h')
-rw-r--r--apps/plugins/fractals/cpu_coldfire.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/apps/plugins/fractals/cpu_coldfire.h b/apps/plugins/fractals/cpu_coldfire.h
index 452f18e2c5..9be207ee2f 100644
--- a/apps/plugins/fractals/cpu_coldfire.h
+++ b/apps/plugins/fractals/cpu_coldfire.h
@@ -22,8 +22,39 @@
#ifndef _CPU_COLDFIRE_H
#define _CPU_COLDFIRE_H
-inline short muls16_asr10(short a, short b);
+inline static short muls16_asr10(short a, short b)
+{
+ asm (
+ "muls.w %[a],%[b] \n"
+ "asr.l #8,%[b] \n"
+ "asr.l #2,%[b] \n"
+ : /* outputs */
+ [b]"+d"(b)
+ : /* inputs */
+ [a]"d" (a)
+ );
+ return b;
+}
-inline long muls32_asr26(long a, long b);
+inline static long muls32_asr26(long a, long b)
+{
+ long r, t1;
+ asm (
+ "mac.l %[a], %[b], %%acc0 \n" /* multiply */
+ "move.l %%accext01, %[t1] \n" /* get low part */
+ "movclr.l %%acc0, %[r] \n" /* get high part */
+ "asl.l #5, %[r] \n" /* hi <<= 5, plus one free */
+ "lsr.l #3, %[t1] \n" /* lo >>= 3 */
+ "and.l #0x1f, %[t1] \n" /* mask out unrelated bits */
+ "or.l %[t1], %[r] \n" /* combine result */
+ : /* outputs */
+ [r] "=d"(r),
+ [t1]"=d"(t1)
+ : /* inputs */
+ [a] "d" (a),
+ [b] "d" (b)
+ );
+ return r;
+}
#endif