|
1 /*Copyright (c) 2013, Xiph.Org Foundation and contributors. |
|
2 |
|
3 All rights reserved. |
|
4 |
|
5 Redistribution and use in source and binary forms, with or without |
|
6 modification, are permitted provided that the following conditions are met: |
|
7 |
|
8 * Redistributions of source code must retain the above copyright notice, |
|
9 this list of conditions and the following disclaimer. |
|
10 * Redistributions in binary form must reproduce the above copyright notice, |
|
11 this list of conditions and the following disclaimer in the |
|
12 documentation and/or other materials provided with the distribution. |
|
13 |
|
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
17 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
|
18 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
20 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
21 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
22 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
23 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
24 POSSIBILITY OF SUCH DAMAGE.*/ |
|
25 |
|
26 #ifndef KISS_FFT_ARMv5E_H |
|
27 #define KISS_FFT_ARMv5E_H |
|
28 |
|
29 #if !defined(KISS_FFT_GUTS_H) |
|
30 #error "This file should only be included from _kiss_fft_guts.h" |
|
31 #endif |
|
32 |
|
33 #ifdef FIXED_POINT |
|
34 |
|
35 #if defined(__thumb__)||defined(__thumb2__) |
|
36 #define LDRD_CONS "Q" |
|
37 #else |
|
38 #define LDRD_CONS "Uq" |
|
39 #endif |
|
40 |
|
41 #undef C_MUL |
|
42 #define C_MUL(m,a,b) \ |
|
43 do{ \ |
|
44 int mr1__; \ |
|
45 int mr2__; \ |
|
46 int mi__; \ |
|
47 long long aval__; \ |
|
48 int bval__; \ |
|
49 __asm__( \ |
|
50 "#C_MUL\n\t" \ |
|
51 "ldrd %[aval], %H[aval], %[ap]\n\t" \ |
|
52 "ldr %[bval], %[bp]\n\t" \ |
|
53 "smulwb %[mi], %H[aval], %[bval]\n\t" \ |
|
54 "smulwb %[mr1], %[aval], %[bval]\n\t" \ |
|
55 "smulwt %[mr2], %H[aval], %[bval]\n\t" \ |
|
56 "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \ |
|
57 : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \ |
|
58 [aval]"=&r"(aval__), [bval]"=r"(bval__) \ |
|
59 : [ap]LDRD_CONS(a), [bp]"m"(b) \ |
|
60 ); \ |
|
61 (m).r = SHL32(SUB32(mr1__, mr2__), 1); \ |
|
62 (m).i = SHL32(mi__, 1); \ |
|
63 } \ |
|
64 while(0) |
|
65 |
|
66 #undef C_MUL4 |
|
67 #define C_MUL4(m,a,b) \ |
|
68 do{ \ |
|
69 int mr1__; \ |
|
70 int mr2__; \ |
|
71 int mi__; \ |
|
72 long long aval__; \ |
|
73 int bval__; \ |
|
74 __asm__( \ |
|
75 "#C_MUL4\n\t" \ |
|
76 "ldrd %[aval], %H[aval], %[ap]\n\t" \ |
|
77 "ldr %[bval], %[bp]\n\t" \ |
|
78 "smulwb %[mi], %H[aval], %[bval]\n\t" \ |
|
79 "smulwb %[mr1], %[aval], %[bval]\n\t" \ |
|
80 "smulwt %[mr2], %H[aval], %[bval]\n\t" \ |
|
81 "smlawt %[mi], %[aval], %[bval], %[mi]\n\t" \ |
|
82 : [mr1]"=r"(mr1__), [mr2]"=r"(mr2__), [mi]"=r"(mi__), \ |
|
83 [aval]"=&r"(aval__), [bval]"=r"(bval__) \ |
|
84 : [ap]LDRD_CONS(a), [bp]"m"(b) \ |
|
85 ); \ |
|
86 (m).r = SHR32(SUB32(mr1__, mr2__), 1); \ |
|
87 (m).i = SHR32(mi__, 1); \ |
|
88 } \ |
|
89 while(0) |
|
90 |
|
91 #undef C_MULC |
|
92 #define C_MULC(m,a,b) \ |
|
93 do{ \ |
|
94 int mr__; \ |
|
95 int mi1__; \ |
|
96 int mi2__; \ |
|
97 long long aval__; \ |
|
98 int bval__; \ |
|
99 __asm__( \ |
|
100 "#C_MULC\n\t" \ |
|
101 "ldrd %[aval], %H[aval], %[ap]\n\t" \ |
|
102 "ldr %[bval], %[bp]\n\t" \ |
|
103 "smulwb %[mr], %[aval], %[bval]\n\t" \ |
|
104 "smulwb %[mi1], %H[aval], %[bval]\n\t" \ |
|
105 "smulwt %[mi2], %[aval], %[bval]\n\t" \ |
|
106 "smlawt %[mr], %H[aval], %[bval], %[mr]\n\t" \ |
|
107 : [mr]"=r"(mr__), [mi1]"=r"(mi1__), [mi2]"=r"(mi2__), \ |
|
108 [aval]"=&r"(aval__), [bval]"=r"(bval__) \ |
|
109 : [ap]LDRD_CONS(a), [bp]"m"(b) \ |
|
110 ); \ |
|
111 (m).r = SHL32(mr__, 1); \ |
|
112 (m).i = SHL32(SUB32(mi1__, mi2__), 1); \ |
|
113 } \ |
|
114 while(0) |
|
115 |
|
116 #endif /* FIXED_POINT */ |
|
117 |
|
118 #endif /* KISS_FFT_GUTS_H */ |