summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
authorDave Bryant <bryant@rockbox.org>2006-03-04 21:26:47 +0000
committerDave Bryant <bryant@rockbox.org>2006-03-04 21:26:47 +0000
commit6472ecfc2eb9fcdd12de57f1ee8689ed924d1692 (patch)
treef836c866b2687572667a6fc638a19d61c7e55489 /apps/dsp.c
parent0b6bb8d8ccaec78e8966f9bf6b9ecfe0ea69412e (diff)
downloadrockbox-6472ecfc2eb9fcdd12de57f1ee8689ed924d1692.tar.gz
rockbox-6472ecfc2eb9fcdd12de57f1ee8689ed924d1692.zip
Added a couple inline assembly functions for ARM targets. This just about
doubles the speed of crossfeed and makes a more modest improvement to the replaygain loop. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8904 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index f9d4bf16d5..0c376a14ea 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -119,6 +119,39 @@
119 119
120#define ACC_INIT(acc, x, y) ACC(acc, x, y) 120#define ACC_INIT(acc, x, y) ACC(acc, x, y)
121 121
122#elif defined(CPU_ARM) && !defined(SIMULATOR)
123
124/* Multiply two S.31 fractional integers and return the sign bit and the
125 * 31 most significant bits of the result.
126 */
127#define FRACMUL(x, y) \
128({ \
129 long t; \
130 asm volatile ("smull r0, r1, %[a], %[b]\n\t" \
131 "mov %[t], r1, asl #1\n\t" \
132 "orr %[t], %[t], r0, lsr #31\n\t" \
133 : [t] "=r" (t) : [a] "r" (x), [b] "r" (y) : "r0", "r1"); \
134 t; \
135})
136
137#define ACC_INIT(acc, x, y) acc = FRACMUL(x, y)
138#define ACC(acc, x, y) acc += FRACMUL(x, y)
139#define GET_ACC(acc) acc
140
141/* Multiply one S.31-bit and one S8.23 fractional integer and store the
142 * sign bit and the 31 most significant bits of the result to d (and
143 * increase d). Load next value to multiply with into x from s (and
144 * increase s); x must contain the initial value.
145 */
146#define FRACMUL_8_LOOP(x, y, s, d) \
147({ \
148 asm volatile ("smull r0, r1, %[a], %[b]\n\t" \
149 "mov %[t], r1, asl #9\n\t" \
150 "orr %[t], %[t], r0, lsr #23\n\t" \
151 : [t] "=r" (*(d)++) : [a] "r" (x), [b] "r" (y) : "r0", "r1"); \
152 x = *(s)++; \
153})
154
122#else 155#else
123 156
124#define ACC_INIT(acc, x, y) acc = FRACMUL(x, y) 157#define ACC_INIT(acc, x, y) acc = FRACMUL(x, y)