mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
libmusepack: add ARMv7-M version of MPC_MULTIPLY_EX
We can't use Operand2 with register based shifts on ARMv7-M as it isn't supported in the Thumb encoding. Instead, perform the shift separately. Change-Id: Ie96aa0a565e98bbca724dffc2ffc6d64fdb5d7c3
This commit is contained in:
parent
c249dea2b7
commit
94c7c908b3
1 changed files with 18 additions and 1 deletions
|
@ -128,7 +128,23 @@
|
|||
: [x]"r"(X), [y]"r"(Y)); \
|
||||
lo; \
|
||||
})
|
||||
|
||||
|
||||
#if defined (CPU_ARM_MICRO)
|
||||
/* Calculate: result = (X*Y)>>Z */
|
||||
#define MPC_MULTIPLY_EX(X,Y,Z) \
|
||||
({ \
|
||||
MPC_SAMPLE_FORMAT lo; \
|
||||
MPC_SAMPLE_FORMAT hi; \
|
||||
asm volatile ( \
|
||||
"smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
|
||||
"mov %[lo], %[lo], lsr %[shr] \n\t" /* lo >>= Z */ \
|
||||
"lsl %[hi], %[hi], %[shl] \n\t" /* hi <<= 32 - Z */ \
|
||||
"orr %[lo], %[lo], %[hi] \n\t" /* lo |= hi */ \
|
||||
: [lo]"=&r"(lo), [hi]"=&r"(hi) \
|
||||
: [x]"r"(X), [y]"r"(Y), [shr]"r"(Z), [shl]"r"(32-Z)); \
|
||||
lo; \
|
||||
})
|
||||
#else
|
||||
/* Calculate: result = (X*Y)>>Z */
|
||||
#define MPC_MULTIPLY_EX(X,Y,Z) \
|
||||
({ \
|
||||
|
@ -142,6 +158,7 @@
|
|||
: [x]"r"(X), [y]"r"(Y), [shr]"r"(Z), [shl]"r"(32-Z)); \
|
||||
lo; \
|
||||
})
|
||||
#endif
|
||||
#else /* libmusepack standard */
|
||||
|
||||
#define MPC_MULTIPLY_NOTRUNCATE(X,Y) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue