diff options
Diffstat (limited to 'apps/codecs/lib/asm_mcf5249.h')
-rw-r--r-- | apps/codecs/lib/asm_mcf5249.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/codecs/lib/asm_mcf5249.h b/apps/codecs/lib/asm_mcf5249.h index 49d2ddf7cb..5fb3cff94a 100644 --- a/apps/codecs/lib/asm_mcf5249.h +++ b/apps/codecs/lib/asm_mcf5249.h | |||
@@ -61,6 +61,21 @@ static inline int32_t MULT31_SHIFT15(int32_t x, int32_t y) { | |||
61 | return r; | 61 | return r; |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline int32_t MULT31_SHIFT16(int32_t x, int32_t y) { | ||
65 | int32_t r; | ||
66 | |||
67 | asm volatile ("mac.l %[x], %[y], %%acc0;" /* multiply */ | ||
68 | "mulu.l %[y], %[x];" /* get lower half, avoid emac stall */ | ||
69 | "movclr.l %%acc0, %[r];" /* get higher half */ | ||
70 | "lsr.l #1, %[r];" /* hi >> 1, to compensate emac shift */ | ||
71 | "move.w %[r], %[x];" /* x = x & 0xffff0000 | r & 0xffff */ | ||
72 | "swap %[x];" /* x = (unsigned)x << 16 | (unsigned)x >> 16 */ | ||
73 | : [r] "=&d" (r), [x] "+d" (x) | ||
74 | : [y] "d" (y) | ||
75 | : "cc"); | ||
76 | return x; | ||
77 | } | ||
78 | |||
64 | static inline | 79 | static inline |
65 | void XPROD31(int32_t a, int32_t b, | 80 | void XPROD31(int32_t a, int32_t b, |
66 | int32_t t, int32_t v, | 81 | int32_t t, int32_t v, |