michael@0: /*Copyright (c) 2013, Xiph.Org Foundation and contributors. michael@0: michael@0: All rights reserved. michael@0: michael@0: Redistribution and use in source and binary forms, with or without michael@0: modification, are permitted provided that the following conditions are met: michael@0: michael@0: * Redistributions of source code must retain the above copyright notice, michael@0: this list of conditions and the following disclaimer. michael@0: * Redistributions in binary form must reproduce the above copyright notice, michael@0: this list of conditions and the following disclaimer in the michael@0: documentation and/or other materials provided with the distribution. michael@0: michael@0: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" michael@0: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE michael@0: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR michael@0: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF michael@0: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS michael@0: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN michael@0: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) michael@0: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE michael@0: POSSIBILITY OF SUCH DAMAGE.*/ michael@0: michael@0: #ifndef KISS_FFT_ARMv5E_H michael@0: #define KISS_FFT_ARMv5E_H michael@0: michael@0: #if !defined(KISS_FFT_GUTS_H) michael@0: #error "This file should only be included from _kiss_fft_guts.h" michael@0: #endif michael@0: michael@0: #ifdef FIXED_POINT michael@0: michael@0: #if defined(__thumb__)||defined(__thumb2__) michael@0: #define LDRD_CONS "Q" michael@0: #else michael@0: #define LDRD_CONS "Uq" michael@0: #endif michael@0: michael@0: #undef C_MUL michael@0: #define C_MUL(m,a,b) \ michael@0: do{ \ michael@0: int mr1__; \ michael@0: int mr2__; \ michael@0: int mi__; \ michael@0: long long aval__; \ michael@0: int bval__; \ michael@0: __asm__( \ michael@0: "#C_MUL\n\t" \ michael@0: "ldrd %[aval], %H[aval], %[ap]\n\t" \ michael@0: "ldr %[bval], %[bp]\n\t" \ michael@0: "smulwb %[mi], %H[aval], %[bval]\n\t" \ michael@0: "smulwb %[mr1], %[aval], %[bval]\n\t" \ michael@0: "smulwt %[mr2], %H[aval], %[bval]\n\t" \ michael@0: "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \ michael@0: : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \ michael@0: [aval]"=&r"(aval__), [bval]"=r"(bval__) \ michael@0: : [ap]LDRD_CONS(a), [bp]"m"(b) \ michael@0: ); \ michael@0: (m).r = SHL32(SUB32(mr1__, mr2__), 1); \ michael@0: (m).i = SHL32(mi__, 1); \ michael@0: } \ michael@0: while(0) michael@0: michael@0: #undef C_MUL4 michael@0: #define C_MUL4(m,a,b) \ michael@0: do{ \ michael@0: int mr1__; \ michael@0: int mr2__; \ michael@0: int mi__; \ michael@0: long long aval__; \ michael@0: int bval__; \ michael@0: __asm__( \ michael@0: "#C_MUL4\n\t" \ michael@0: "ldrd %[aval], %H[aval], %[ap]\n\t" \ michael@0: "ldr %[bval], %[bp]\n\t" \ michael@0: "smulwb %[mi], %H[aval], %[bval]\n\t" \ michael@0: "smulwb %[mr1], %[aval], %[bval]\n\t" \ michael@0: "smulwt %[mr2], %H[aval], %[bval]\n\t" \ michael@0: "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \ michael@0: : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \ michael@0: [aval]"=&r"(aval__), [bval]"=r"(bval__) \ michael@0: : [ap]LDRD_CONS(a), [bp]"m"(b) \ michael@0: ); \ michael@0: (m).r = SHR32(SUB32(mr1__, mr2__), 1); \ michael@0: (m).i = SHR32(mi__, 1); \ michael@0: } \ michael@0: while(0) michael@0: michael@0: #undef C_MULC michael@0: #define C_MULC(m,a,b) \ michael@0: do{ \ michael@0: int mr__; \ michael@0: int mi1__; \ michael@0: int mi2__; \ michael@0: long long aval__; \ michael@0: int bval__; \ michael@0: __asm__( \ michael@0: "#C_MULC\n\t" \ michael@0: "ldrd %[aval], %H[aval], %[ap]\n\t" \ michael@0: "ldr %[bval], %[bp]\n\t" \ michael@0: "smulwb %[mr], %[aval], %[bval]\n\t" \ michael@0: "smulwb %[mi1], %H[aval], %[bval]\n\t" \ michael@0: "smulwt %[mi2], %[aval], %[bval]\n\t" \ michael@0: "smlawt %[mr], %H[aval], %[bval], %[mr]\n\t" \ michael@0: : [mr]"=r"(mr__), [mi1]"=r"(mi1__), [mi2]"=r"(mi2__), \ michael@0: [aval]"=&r"(aval__), [bval]"=r"(bval__) \ michael@0: : [ap]LDRD_CONS(a), [bp]"m"(b) \ michael@0: ); \ michael@0: (m).r = SHL32(mr__, 1); \ michael@0: (m).i = SHL32(SUB32(mi1__, mi2__), 1); \ michael@0: } \ michael@0: while(0) michael@0: michael@0: #endif /* FIXED_POINT */ michael@0: michael@0: #endif /* KISS_FFT_GUTS_H */