summaryrefslogtreecommitdiff
path: root/apps/codecs/libatrac
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-05-29 14:56:25 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-05-29 14:56:25 +0000
commit9ab57e510e5ff64c5ce3d6bf47d7bf1ff8261e01 (patch)
tree64b75043581d949accee5c9cdaec74275ed6ec74 /apps/codecs/libatrac
parent56220785c11d9ad62b552a8f1ba44d779d5edf48 (diff)
downloadrockbox-9ab57e510e5ff64c5ce3d6bf47d7bf1ff8261e01.zip
rockbox-9ab57e510e5ff64c5ce3d6bf47d7bf1ff8261e01.tar.gz
rockbox-9ab57e510e5ff64c5ce3d6bf47d7bf1ff8261e01.tar.bz2
rockbox-9ab57e510e5ff64c5ce3d6bf47d7bf1ff8261e01.tar.xz
Small changes to asm for better readability.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26375 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libatrac')
-rw-r--r--apps/codecs/libatrac/fixp_math.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/apps/codecs/libatrac/fixp_math.h b/apps/codecs/libatrac/fixp_math.h
index ac53310..8d2e078 100644
--- a/apps/codecs/libatrac/fixp_math.h
+++ b/apps/codecs/libatrac/fixp_math.h
@@ -31,30 +31,33 @@
/* Fixed point math routines for use in atrac3.c */
#if defined(CPU_ARM)
+ /* Calculates: result = (X*Y)>>16 */
#define fixmul16(X,Y) \
({ \
- int32_t low; \
- int32_t high; \
- asm volatile ( /* calculates: result = (X*Y)>>16 */ \
- "smull %0,%1,%2,%3 \n\t" /* 64 = 32x32 multiply */ \
- "mov %0, %0, lsr #16 \n\t" /* %0 = %0 >> 16 */ \
- "orr %0, %0, %1, lsl #16 \n\t"/* result = %0 OR (%1 << 16) */ \
- : "=&r"(low), "=&r" (high) \
- : "r"(X),"r"(Y)); \
- low; \
+ int32_t lo; \
+ int32_t hi; \
+ asm volatile ( \
+ "smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
+ "mov %[lo], %[lo], lsr #16 \n\t" /* lo >>= 16 */ \
+ "orr %[lo], %[lo], %[hi], lsl #16" /* lo |= (hi << 16) */ \
+ : [lo]"=&r"(lo), [hi]"=&r"(hi) \
+ : [x]"r"(X), [y]"r"(Y)); \
+ lo; \
})
+ /* Calculates: result = (X*Y)>>31 */
+ /* Use scratch register r12 */
#define fixmul31(X,Y) \
({ \
- int32_t low; \
- int32_t high; \
- asm volatile ( /* calculates: result = (X*Y)>>31 */ \
- "smull %0,%1,%2,%3 \n\t" /* 64 = 32x32 multiply */ \
- "mov %0, %0, lsr #31 \n\t" /* %0 = %0 >> 31 */ \
- "orr %0, %0, %1, lsl #1 \n\t" /* result = %0 OR (%1 << 1) */ \
- : "=&r"(low), "=&r" (high) \
- : "r"(X),"r"(Y)); \
- low; \
+ int32_t lo; \
+ int32_t hi; \
+ asm volatile ( \
+ "smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
+ "mov %[lo], %[lo], lsr #31 \n\t" /* lo >>= 31 */ \
+ "orr %[lo], %[lo], %[hi], lsl #1" /* lo |= (hi << 1) */ \
+ : [lo]"=&r"(lo), [hi]"=&r"(hi) \
+ : [x]"r"(X), [y]"r"(Y)); \
+ lo; \
})
#elif defined(CPU_COLDFIRE)
#define fixmul16(X,Y) \