| OLD | NEW |
| 1 /* Copyright (C) 2007-2009 Xiph.Org Foundation | 1 /* Copyright (C) 2007-2009 Xiph.Org Foundation |
| 2 Copyright (C) 2003-2008 Jean-Marc Valin | 2 Copyright (C) 2003-2008 Jean-Marc Valin |
| 3 Copyright (C) 2007-2008 CSIRO | 3 Copyright (C) 2007-2008 CSIRO |
| 4 Copyright (C) 2013 Parrot */ | 4 Copyright (C) 2013 Parrot */ |
| 5 /* | 5 /* |
| 6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
| 7 modification, are permitted provided that the following conditions | 7 modification, are permitted provided that the following conditions |
| 8 are met: | 8 are met: |
| 9 | 9 |
| 10 - Redistributions of source code must retain the above copyright | 10 - Redistributions of source code must retain the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef FIXED_ARMv5E_H | 30 #ifndef FIXED_ARMv5E_H |
| 31 #define FIXED_ARMv5E_H | 31 #define FIXED_ARMv5E_H |
| 32 | 32 |
| 33 #include "fixed_armv4.h" | 33 #include "fixed_armv4.h" |
| 34 | 34 |
| 35 /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 b
its */ | 35 /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 b
its */ |
| 36 #undef MULT16_32_Q16 | 36 #undef MULT16_32_Q16 |
| 37 static inline opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) | 37 static OPUS_INLINE opus_val32 MULT16_32_Q16_armv5e(opus_val16 a, opus_val32 b) |
| 38 { | 38 { |
| 39 int res; | 39 int res; |
| 40 __asm__( | 40 __asm__( |
| 41 "#MULT16_32_Q16\n\t" | 41 "#MULT16_32_Q16\n\t" |
| 42 "smulwb %0, %1, %2\n\t" | 42 "smulwb %0, %1, %2\n\t" |
| 43 : "=r"(res) | 43 : "=r"(res) |
| 44 : "r"(b),"r"(a) | 44 : "r"(b),"r"(a) |
| 45 ); | 45 ); |
| 46 return res; | 46 return res; |
| 47 } | 47 } |
| 48 #define MULT16_32_Q16(a, b) (MULT16_32_Q16_armv5e(a, b)) | 48 #define MULT16_32_Q16(a, b) (MULT16_32_Q16_armv5e(a, b)) |
| 49 | 49 |
| 50 | 50 |
| 51 /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 b
its */ | 51 /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 b
its */ |
| 52 #undef MULT16_32_Q15 | 52 #undef MULT16_32_Q15 |
| 53 static inline opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) | 53 static OPUS_INLINE opus_val32 MULT16_32_Q15_armv5e(opus_val16 a, opus_val32 b) |
| 54 { | 54 { |
| 55 int res; | 55 int res; |
| 56 __asm__( | 56 __asm__( |
| 57 "#MULT16_32_Q15\n\t" | 57 "#MULT16_32_Q15\n\t" |
| 58 "smulwb %0, %1, %2\n\t" | 58 "smulwb %0, %1, %2\n\t" |
| 59 : "=r"(res) | 59 : "=r"(res) |
| 60 : "r"(b), "r"(a) | 60 : "r"(b), "r"(a) |
| 61 ); | 61 ); |
| 62 return res<<1; | 62 return res<<1; |
| 63 } | 63 } |
| 64 #define MULT16_32_Q15(a, b) (MULT16_32_Q15_armv5e(a, b)) | 64 #define MULT16_32_Q15(a, b) (MULT16_32_Q15_armv5e(a, b)) |
| 65 | 65 |
| 66 | 66 |
| 67 /** 16x32 multiply, followed by a 15-bit shift right and 32-bit add. | 67 /** 16x32 multiply, followed by a 15-bit shift right and 32-bit add. |
| 68 b must fit in 31 bits. | 68 b must fit in 31 bits. |
| 69 Result fits in 32 bits. */ | 69 Result fits in 32 bits. */ |
| 70 #undef MAC16_32_Q15 | 70 #undef MAC16_32_Q15 |
| 71 static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, | 71 static OPUS_INLINE opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, |
| 72 opus_val32 b) | 72 opus_val32 b) |
| 73 { | 73 { |
| 74 int res; | 74 int res; |
| 75 __asm__( | 75 __asm__( |
| 76 "#MAC16_32_Q15\n\t" | 76 "#MAC16_32_Q15\n\t" |
| 77 "smlawb %0, %1, %2, %3;\n" | 77 "smlawb %0, %1, %2, %3;\n" |
| 78 : "=r"(res) | 78 : "=r"(res) |
| 79 : "r"(b<<1), "r"(a), "r"(c) | 79 : "r"(b<<1), "r"(a), "r"(c) |
| 80 ); | 80 ); |
| 81 return res; | 81 return res; |
| 82 } | 82 } |
| 83 #define MAC16_32_Q15(c, a, b) (MAC16_32_Q15_armv5e(c, a, b)) | 83 #define MAC16_32_Q15(c, a, b) (MAC16_32_Q15_armv5e(c, a, b)) |
| 84 | 84 |
| 85 /** 16x16 multiply-add where the result fits in 32 bits */ | 85 /** 16x16 multiply-add where the result fits in 32 bits */ |
| 86 #undef MAC16_16 | 86 #undef MAC16_16 |
| 87 static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, | 87 static OPUS_INLINE opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, |
| 88 opus_val16 b) | 88 opus_val16 b) |
| 89 { | 89 { |
| 90 int res; | 90 int res; |
| 91 __asm__( | 91 __asm__( |
| 92 "#MAC16_16\n\t" | 92 "#MAC16_16\n\t" |
| 93 "smlabb %0, %1, %2, %3;\n" | 93 "smlabb %0, %1, %2, %3;\n" |
| 94 : "=r"(res) | 94 : "=r"(res) |
| 95 : "r"(a), "r"(b), "r"(c) | 95 : "r"(a), "r"(b), "r"(c) |
| 96 ); | 96 ); |
| 97 return res; | 97 return res; |
| 98 } | 98 } |
| 99 #define MAC16_16(c, a, b) (MAC16_16_armv5e(c, a, b)) | 99 #define MAC16_16(c, a, b) (MAC16_16_armv5e(c, a, b)) |
| 100 | 100 |
| 101 /** 16x16 multiplication where the result fits in 32 bits */ | 101 /** 16x16 multiplication where the result fits in 32 bits */ |
| 102 #undef MULT16_16 | 102 #undef MULT16_16 |
| 103 static inline opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) | 103 static OPUS_INLINE opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) |
| 104 { | 104 { |
| 105 int res; | 105 int res; |
| 106 __asm__( | 106 __asm__( |
| 107 "#MULT16_16\n\t" | 107 "#MULT16_16\n\t" |
| 108 "smulbb %0, %1, %2;\n" | 108 "smulbb %0, %1, %2;\n" |
| 109 : "=r"(res) | 109 : "=r"(res) |
| 110 : "r"(a), "r"(b) | 110 : "r"(a), "r"(b) |
| 111 ); | 111 ); |
| 112 return res; | 112 return res; |
| 113 } | 113 } |
| 114 #define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) | 114 #define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) |
| 115 | 115 |
| 116 #endif | 116 #endif |
| OLD | NEW |