summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-07-28 18:17:56 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-07-28 18:17:56 +0000
commitae37fadb1b713b93272d406e9f320edf3511ac6e (patch)
treef130708db0f14b92739a68669d38d745af58dc62 /apps
parent8cc8bb9bde265959ad69b3fc5cc84201461af1fb (diff)
downloadrockbox-ae37fadb1b713b93272d406e9f320edf3511ac6e.tar.gz
rockbox-ae37fadb1b713b93272d406e9f320edf3511ac6e.zip
Submit FS#11502. Minor optimization to Coldfire assembler in libatrac's fixmul16(). Thanks to Nils Willménius.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27596 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libatrac/fixp_math.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/apps/codecs/libatrac/fixp_math.h b/apps/codecs/libatrac/fixp_math.h
index 8d2e0783b8..014c5aa559 100644
--- a/apps/codecs/libatrac/fixp_math.h
+++ b/apps/codecs/libatrac/fixp_math.h
@@ -60,25 +60,20 @@
60 lo; \ 60 lo; \
61 }) 61 })
62#elif defined(CPU_COLDFIRE) 62#elif defined(CPU_COLDFIRE)
63 /* Calculates: result = (X*Y)>>16 */
63 #define fixmul16(X,Y) \ 64 #define fixmul16(X,Y) \
64 ({ \ 65 ({ \
65 int32_t t1, t2; \ 66 int32_t t, x = (X); \
66 asm volatile ( \ 67 asm volatile ( \
67 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \ 68 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \
68 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \ 69 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \
69 "movclr.l %%acc0,%[t1] \n\t" /* get higher half */ \ 70 "movclr.l %%acc0,%[t] \n\t" /* get higher half */ \
70 "moveq.l #15,%[t2] \n\t" \ 71 "lsr.l #1,%[t] \n\t" /* hi >>= 1 to compensate emac shift */ \
71 "asl.l %[t2],%[t1] \n\t" /* hi <<= 15, plus one free */ \ 72 "move.w %[t],%[x] \n\t" /* combine halfwords */\
72 "moveq.l #16,%[t2] \n\t" \ 73 "swap %[x] \n\t" \
73 "lsr.l %[t2],%[x] \n\t" /* (unsigned)lo >>= 16 */ \ 74 : [t]"=&d"(t), [x] "+d" (x) \
74 "or.l %[x],%[t1] \n\t" /* combine result */ \ 75 : [y] "d" ((Y))); \
75 : /* outputs */ \ 76 x; \
76 [t1]"=&d"(t1), \
77 [t2]"=&d"(t2) \
78 : /* inputs */ \
79 [x] "d" ((X)), \
80 [y] "d" ((Y))); \
81 t1; \
82 }) 77 })
83 78
84 #define fixmul31(X,Y) \ 79 #define fixmul31(X,Y) \