annotate src/opus-1.3/celt/mips/fixed_generic_mipsr1.h @ 79:91c729825bca pa_catalina

Update build for AUDIO_COMPONENT_FIX
author Chris Cannam
date Wed, 30 Oct 2019 12:40:34 +0000
parents 7aeed7906520
children
rev   line source
Chris@69 1 /* Copyright (C) 2007-2009 Xiph.Org Foundation
Chris@69 2 Copyright (C) 2003-2008 Jean-Marc Valin
Chris@69 3 Copyright (C) 2007-2008 CSIRO */
Chris@69 4 /**
Chris@69 5 @file fixed_generic.h
Chris@69 6 @brief Generic fixed-point operations
Chris@69 7 */
Chris@69 8 /*
Chris@69 9 Redistribution and use in source and binary forms, with or without
Chris@69 10 modification, are permitted provided that the following conditions
Chris@69 11 are met:
Chris@69 12
Chris@69 13 - Redistributions of source code must retain the above copyright
Chris@69 14 notice, this list of conditions and the following disclaimer.
Chris@69 15
Chris@69 16 - Redistributions in binary form must reproduce the above copyright
Chris@69 17 notice, this list of conditions and the following disclaimer in the
Chris@69 18 documentation and/or other materials provided with the distribution.
Chris@69 19
Chris@69 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Chris@69 21 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Chris@69 22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Chris@69 23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
Chris@69 24 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Chris@69 25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Chris@69 26 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Chris@69 27 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Chris@69 28 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Chris@69 29 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Chris@69 30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Chris@69 31 */
Chris@69 32
Chris@69 33 #ifndef CELT_FIXED_GENERIC_MIPSR1_H
Chris@69 34 #define CELT_FIXED_GENERIC_MIPSR1_H
Chris@69 35
Chris@69 36 #undef MULT16_32_Q15_ADD
Chris@69 37 static inline int MULT16_32_Q15_ADD(int a, int b, int c, int d) {
Chris@69 38 int m;
Chris@69 39 asm volatile("MULT $ac1, %0, %1" : : "r" ((int)a), "r" ((int)b));
Chris@69 40 asm volatile("madd $ac1, %0, %1" : : "r" ((int)c), "r" ((int)d));
Chris@69 41 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (m): "i" (15));
Chris@69 42 return m;
Chris@69 43 }
Chris@69 44
Chris@69 45 #undef MULT16_32_Q15_SUB
Chris@69 46 static inline int MULT16_32_Q15_SUB(int a, int b, int c, int d) {
Chris@69 47 int m;
Chris@69 48 asm volatile("MULT $ac1, %0, %1" : : "r" ((int)a), "r" ((int)b));
Chris@69 49 asm volatile("msub $ac1, %0, %1" : : "r" ((int)c), "r" ((int)d));
Chris@69 50 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (m): "i" (15));
Chris@69 51 return m;
Chris@69 52 }
Chris@69 53
Chris@69 54 #undef MULT16_16_Q15_ADD
Chris@69 55 static inline int MULT16_16_Q15_ADD(int a, int b, int c, int d) {
Chris@69 56 int m;
Chris@69 57 asm volatile("MULT $ac1, %0, %1" : : "r" ((int)a), "r" ((int)b));
Chris@69 58 asm volatile("madd $ac1, %0, %1" : : "r" ((int)c), "r" ((int)d));
Chris@69 59 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (m): "i" (15));
Chris@69 60 return m;
Chris@69 61 }
Chris@69 62
Chris@69 63 #undef MULT16_16_Q15_SUB
Chris@69 64 static inline int MULT16_16_Q15_SUB(int a, int b, int c, int d) {
Chris@69 65 int m;
Chris@69 66 asm volatile("MULT $ac1, %0, %1" : : "r" ((int)a), "r" ((int)b));
Chris@69 67 asm volatile("msub $ac1, %0, %1" : : "r" ((int)c), "r" ((int)d));
Chris@69 68 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (m): "i" (15));
Chris@69 69 return m;
Chris@69 70 }
Chris@69 71
Chris@69 72
Chris@69 73 #undef MULT16_32_Q16
Chris@69 74 static inline int MULT16_32_Q16(int a, int b)
Chris@69 75 {
Chris@69 76 int c;
Chris@69 77 asm volatile("MULT $ac1,%0, %1" : : "r" (a), "r" (b));
Chris@69 78 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (c): "i" (16));
Chris@69 79 return c;
Chris@69 80 }
Chris@69 81
Chris@69 82 #undef MULT16_32_P16
Chris@69 83 static inline int MULT16_32_P16(int a, int b)
Chris@69 84 {
Chris@69 85 int c;
Chris@69 86 asm volatile("MULT $ac1, %0, %1" : : "r" (a), "r" (b));
Chris@69 87 asm volatile("EXTR_R.W %0,$ac1, %1" : "=r" (c): "i" (16));
Chris@69 88 return c;
Chris@69 89 }
Chris@69 90
Chris@69 91 #undef MULT16_32_Q15
Chris@69 92 static inline int MULT16_32_Q15(int a, int b)
Chris@69 93 {
Chris@69 94 int c;
Chris@69 95 asm volatile("MULT $ac1, %0, %1" : : "r" (a), "r" (b));
Chris@69 96 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (c): "i" (15));
Chris@69 97 return c;
Chris@69 98 }
Chris@69 99
Chris@69 100 #undef MULT32_32_Q31
Chris@69 101 static inline int MULT32_32_Q31(int a, int b)
Chris@69 102 {
Chris@69 103 int r;
Chris@69 104 asm volatile("MULT $ac1, %0, %1" : : "r" (a), "r" (b));
Chris@69 105 asm volatile("EXTR.W %0,$ac1, %1" : "=r" (r): "i" (31));
Chris@69 106 return r;
Chris@69 107 }
Chris@69 108
Chris@69 109 #undef PSHR32
Chris@69 110 static inline int PSHR32(int a, int shift)
Chris@69 111 {
Chris@69 112 int r;
Chris@69 113 asm volatile ("SHRAV_R.W %0, %1, %2" :"=r" (r): "r" (a), "r" (shift));
Chris@69 114 return r;
Chris@69 115 }
Chris@69 116
Chris@69 117 #undef MULT16_16_P15
Chris@69 118 static inline int MULT16_16_P15(int a, int b)
Chris@69 119 {
Chris@69 120 int r;
Chris@69 121 asm volatile ("mul %0, %1, %2" :"=r" (r): "r" (a), "r" (b));
Chris@69 122 asm volatile ("SHRA_R.W %0, %1, %2" : "+r" (r): "0" (r), "i"(15));
Chris@69 123 return r;
Chris@69 124 }
Chris@69 125
Chris@69 126 #endif /* CELT_FIXED_GENERIC_MIPSR1_H */