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_ARMv4_H michael@0: #define KISS_FFT_ARMv4_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: #undef C_MUL michael@0: #define C_MUL(m,a,b) \ michael@0: do{ \ michael@0: int br__; \ michael@0: int bi__; \ michael@0: int tt__; \ michael@0: __asm__ __volatile__( \ michael@0: "#C_MUL\n\t" \ michael@0: "ldrsh %[br], [%[bp], #0]\n\t" \ michael@0: "ldm %[ap], {r0,r1}\n\t" \ michael@0: "ldrsh %[bi], [%[bp], #2]\n\t" \ michael@0: "smull %[tt], %[mi], r1, %[br]\n\t" \ michael@0: "smlal %[tt], %[mi], r0, %[bi]\n\t" \ michael@0: "rsb %[bi], %[bi], #0\n\t" \ michael@0: "smull %[br], %[mr], r0, %[br]\n\t" \ michael@0: "mov %[tt], %[tt], lsr #15\n\t" \ michael@0: "smlal %[br], %[mr], r1, %[bi]\n\t" \ michael@0: "orr %[mi], %[tt], %[mi], lsl #17\n\t" \ michael@0: "mov %[br], %[br], lsr #15\n\t" \ michael@0: "orr %[mr], %[br], %[mr], lsl #17\n\t" \ michael@0: : [mr]"=r"((m).r), [mi]"=r"((m).i), \ michael@0: [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \ michael@0: : [ap]"r"(&(a)), [bp]"r"(&(b)) \ michael@0: : "r0", "r1" \ michael@0: ); \ 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 br__; \ michael@0: int bi__; \ michael@0: int tt__; \ michael@0: __asm__ __volatile__( \ michael@0: "#C_MUL4\n\t" \ michael@0: "ldrsh %[br], [%[bp], #0]\n\t" \ michael@0: "ldm %[ap], {r0,r1}\n\t" \ michael@0: "ldrsh %[bi], [%[bp], #2]\n\t" \ michael@0: "smull %[tt], %[mi], r1, %[br]\n\t" \ michael@0: "smlal %[tt], %[mi], r0, %[bi]\n\t" \ michael@0: "rsb %[bi], %[bi], #0\n\t" \ michael@0: "smull %[br], %[mr], r0, %[br]\n\t" \ michael@0: "mov %[tt], %[tt], lsr #17\n\t" \ michael@0: "smlal %[br], %[mr], r1, %[bi]\n\t" \ michael@0: "orr %[mi], %[tt], %[mi], lsl #15\n\t" \ michael@0: "mov %[br], %[br], lsr #17\n\t" \ michael@0: "orr %[mr], %[br], %[mr], lsl #15\n\t" \ michael@0: : [mr]"=r"((m).r), [mi]"=r"((m).i), \ michael@0: [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \ michael@0: : [ap]"r"(&(a)), [bp]"r"(&(b)) \ michael@0: : "r0", "r1" \ michael@0: ); \ 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 br__; \ michael@0: int bi__; \ michael@0: int tt__; \ michael@0: __asm__ __volatile__( \ michael@0: "#C_MULC\n\t" \ michael@0: "ldrsh %[br], [%[bp], #0]\n\t" \ michael@0: "ldm %[ap], {r0,r1}\n\t" \ michael@0: "ldrsh %[bi], [%[bp], #2]\n\t" \ michael@0: "smull %[tt], %[mr], r0, %[br]\n\t" \ michael@0: "smlal %[tt], %[mr], r1, %[bi]\n\t" \ michael@0: "rsb %[bi], %[bi], #0\n\t" \ michael@0: "smull %[br], %[mi], r1, %[br]\n\t" \ michael@0: "mov %[tt], %[tt], lsr #15\n\t" \ michael@0: "smlal %[br], %[mi], r0, %[bi]\n\t" \ michael@0: "orr %[mr], %[tt], %[mr], lsl #17\n\t" \ michael@0: "mov %[br], %[br], lsr #15\n\t" \ michael@0: "orr %[mi], %[br], %[mi], lsl #17\n\t" \ michael@0: : [mr]"=r"((m).r), [mi]"=r"((m).i), \ michael@0: [br]"=&r"(br__), [bi]"=r"(bi__), [tt]"=r"(tt__) \ michael@0: : [ap]"r"(&(a)), [bp]"r"(&(b)) \ michael@0: : "r0", "r1" \ michael@0: ); \ michael@0: } \ michael@0: while(0) michael@0: michael@0: #endif /* FIXED_POINT */ michael@0: michael@0: #endif /* KISS_FFT_ARMv4_H */