|
|
|
|
|
|
|
|
return out; |
|
|
return out; |
|
|
} |
|
|
} |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#if defined (__ARM_ARCH_7EM__) |
|
|
// computes (((a[31:16] + b[31:16]) << 16) | (a[15:0 + b[15:0])) (saturates) |
|
|
// computes (((a[31:16] + b[31:16]) << 16) | (a[15:0 + b[15:0])) (saturates) |
|
|
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) __attribute__((always_inline, unused)); |
|
|
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) __attribute__((always_inline, unused)); |
|
|
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) |
|
|
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) |
|
|
|
|
|
|
|
|
return out; |
|
|
return out; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Multiply two S.31 fractional integers, and return the 32 most significant |
|
|
|
|
|
// bits after a shift left by the constant z. |
|
|
|
|
|
// This comes from rockbox.org |
|
|
|
|
|
|
|
|
|
|
|
static inline int32_t FRACMUL_SHL(int32_t x, int32_t y, int z) |
|
|
|
|
|
{ |
|
|
|
|
|
int32_t t, t2; |
|
|
|
|
|
asm ("smull %[t], %[t2], %[a], %[b]\n\t" |
|
|
|
|
|
"mov %[t2], %[t2], asl %[c]\n\t" |
|
|
|
|
|
"orr %[t], %[t2], %[t], lsr %[d]\n\t" |
|
|
|
|
|
: [t] "=&r" (t), [t2] "=&r" (t2) |
|
|
|
|
|
: [a] "r" (x), [b] "r" (y), |
|
|
|
|
|
[c] "Mr" ((z) + 1), [d] "Mr" (31 - (z))); |
|
|
|
|
|
return t; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
//get Q from PSR |
|
|
//get Q from PSR |
|
|
static inline uint32_t get_q_psr(void) __attribute__((always_inline, unused)); |
|
|
static inline uint32_t get_q_psr(void) __attribute__((always_inline, unused)); |
|
|
static inline uint32_t get_q_psr(void) |
|
|
static inline uint32_t get_q_psr(void) |
|
|
|
|
|
|
|
|
"msr APSR_nzcvq,%0\n" : [t] "=&r" (t)::"cc"); |
|
|
"msr APSR_nzcvq,%0\n" : [t] "=&r" (t)::"cc"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Multiply two S.31 fractional integers, and return the 32 most significant |
|
|
|
|
|
// bits after a shift left by the constant z. |
|
|
|
|
|
// This comes from rockbox.org |
|
|
|
|
|
|
|
|
|
|
|
static inline int32_t FRACMUL_SHL(int32_t x, int32_t y, int z) |
|
|
|
|
|
{ |
|
|
|
|
|
int32_t t, t2; |
|
|
|
|
|
asm ("smull %[t], %[t2], %[a], %[b]\n\t" |
|
|
|
|
|
"mov %[t2], %[t2], asl %[c]\n\t" |
|
|
|
|
|
"orr %[t], %[t2], %[t], lsr %[d]\n\t" |
|
|
|
|
|
: [t] "=&r" (t), [t2] "=&r" (t2) |
|
|
|
|
|
: [a] "r" (x), [b] "r" (y), |
|
|
|
|
|
[c] "Mr" ((z) + 1), [d] "Mr" (31 - (z))); |
|
|
|
|
|
return t; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |