1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Tomasz Malesinski
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 /* Codecs should not normally do this, but we need to check a macro, and
24 * codecs.h would confuse the assembler. */
26 #define cPI3_8 (0x30fbc54d)
27 #define cPI2_8 (0x5a82799a)
28 #define cPI1_8 (0x7641af3d)
31 .section .icode,"ax",%progbits
37 .global mdct_butterfly_32
38 .global mdct_butterfly_generic_loop
41 add r9, r5, r1 @ x4 + x0
42 sub r5, r5, r1 @ x4 - x0
43 add r7, r6, r2 @ x5 + x1
44 sub r6, r6, r2 @ x5 - x1
45 add r8, r10, r3 @ x6 + x2
46 sub r10, r10, r3 @ x6 - x2
47 add r12, r11, r4 @ x7 + x3
48 sub r11, r11, r4 @ x7 - x3
50 add r1, r10, r6 @ y0 = (x6 - x2) + (x5 - x1)
51 sub r2, r11, r5 @ y1 = (x7 - x3) - (x4 - x0)
52 sub r3, r10, r6 @ y2 = (x6 - x2) - (x5 - x1)
53 add r4, r11, r5 @ y3 = (x7 - x3) + (x4 - x0)
54 sub r5, r8, r9 @ y4 = (x6 + x2) - (x4 + x0)
55 sub r6, r12, r7 @ y5 = (x7 + x3) - (x5 + x1)
56 add r10, r8, r9 @ y6 = (x6 + x2) + (x4 + x0)
57 add r11, r12, r7 @ y7 = (x7 + x3) + (x5 + x1)
58 stmia r0, {r1, r2, r3, r4, r5, r6, r10, r11}
66 ldmia r0, {r2, r3, r4, r5}
67 ldmia r1, {r6, r7, r8, r9}
68 add r6, r6, r2 @ y8 = x8 + x0
69 rsb r2, r6, r2, asl #1 @ x0 - x8
70 add r7, r7, r3 @ y9 = x9 + x1
71 rsb r3, r7, r3, asl #1 @ x1 - x9
72 add r8, r8, r4 @ y10 = x10 + x2
73 sub r11, r8, r4, asl #1 @ x10 - x2
74 add r9, r9, r5 @ y11 = x11 + x3
75 rsb r10, r9, r5, asl #1 @ x3 - x11
77 stmia r1!, {r6, r7, r8, r9}
79 add r2, r2, r3 @ (x0 - x8) + (x1 - x9)
80 rsb r3, r2, r3, asl #1 @ (x1 - x9) - (x0 - x8)
88 stmia r0!, {r5, r6, r10, r11}
90 ldmia r0, {r2, r3, r4, r5}
91 ldmia r1, {r6, r7, r8, r9}
92 add r6, r6, r2 @ y12 = x12 + x4
93 sub r2, r6, r2, asl #1 @ x12 - x4
94 add r7, r7, r3 @ y13 = x13 + x5
95 sub r3, r7, r3, asl #1 @ x13 - x5
96 add r8, r8, r4 @ y10 = x14 + x6
97 sub r10, r8, r4, asl #1 @ x14 - x6
98 add r9, r9, r5 @ y11 = x15 + x7
99 sub r11, r9, r5, asl #1 @ x15 - x7
101 stmia r1, {r6, r7, r8, r9}
103 sub r2, r2, r3 @ (x12 - x4) - (x13 - x5)
104 add r3, r2, r3, asl #1 @ (x12 - x4) + (x13 - x5)
106 smull r8, r5, r12, r2
107 smull r8, r6, r12, r3
110 @ no stmia here, r5, r6, r10, r11 are passed to mdct_butterfly_8
113 ldmia r0, {r1, r2, r3, r4}
116 ldmia r0, {r1, r2, r3, r4, r5, r6, r10, r11}
122 stmdb sp!, {r4-r11, lr}
126 ldmia r0, {r2, r3, r4, r5}
127 ldmia r1, {r6, r7, r8, r9}
128 add r6, r6, r2 @ y16 = x16 + x0
129 rsb r2, r6, r2, asl #1 @ x0 - x16
130 add r7, r7, r3 @ y17 = x17 + x1
131 rsb r3, r7, r3, asl #1 @ x1 - x17
132 add r8, r8, r4 @ y18 = x18 + x2
133 rsb r4, r8, r4, asl #1 @ x2 - x18
134 add r9, r9, r5 @ y19 = x19 + x3
135 rsb r5, r9, r5, asl #1 @ x3 - x19
137 stmia r1!, {r6, r7, r8, r9}
141 smull r10, r6, r12, r2
143 smlal r10, r6, lr, r3
144 smull r10, r7, r12, r3
145 smlal r10, r7, lr, r2
149 add r4, r4, r5 @ (x3 - x19) + (x2 - x18)
150 rsb r5, r4, r5, asl #1 @ (x3 - x19) - (x2 - x18)
153 smull r10, r8, r4, r11
154 smull r10, r9, r5, r11
158 stmia r0!, {r6, r7, r8, r9}
160 ldmia r0, {r2, r3, r4, r5}
161 ldmia r1, {r6, r7, r8, r9}
162 add r6, r6, r2 @ y20 = x20 + x4
163 rsb r2, r6, r2, asl #1 @ x4 - x20
164 add r7, r7, r3 @ y21 = x21 + x5
165 rsb r3, r7, r3, asl #1 @ x5 - x21
166 add r8, r8, r4 @ y22 = x22 + x6
167 sub r4, r8, r4, asl #1 @ x22 - x6
168 add r9, r9, r5 @ y23 = x23 + x7
169 rsb r5, r9, r5, asl #1 @ x7 - x23
171 stmia r1!, {r6, r7, r8, r9}
173 smull r10, r6, lr, r2
175 smlal r10, r6, r12, r3
176 smull r10, r7, lr, r3
177 smlal r10, r7, r12, r2
183 stmia r0!, {r6, r7, r8, r9}
185 ldmia r0, {r2, r3, r4, r5}
186 ldmia r1, {r6, r7, r8, r9}
187 add r6, r6, r2 @ y24 = x24 + x8
188 sub r2, r6, r2, asl #1 @ x24 - x8
189 add r7, r7, r3 @ y25 = x25 + x9
190 sub r3, r7, r3, asl #1 @ x25 - x9
191 add r8, r8, r4 @ y26 = x26 + x10
192 sub r4, r8, r4, asl #1 @ x26 - x10
193 add r9, r9, r5 @ y27 = x27 + x11
194 sub r5, r9, r5, asl #1 @ x27 - x11
196 stmia r1!, {r6, r7, r8, r9}
198 smull r10, r7, lr, r3
200 smlal r10, r7, r12, r2
201 smull r10, r6, r12, r3
202 smlal r10, r6, lr, r2
206 sub r4, r4, r5 @ (x26 - x10) - (x27 - x11)
207 add r5, r4, r5, asl #1 @ (x26 - x10) + (x27 - x11)
210 smull r10, r8, r11, r4
211 smull r10, r9, r11, r5
215 stmia r0!, {r6, r7, r8, r9}
217 ldmia r0, {r2, r3, r4, r5}
218 ldmia r1, {r6, r7, r8, r9}
219 add r6, r6, r2 @ y28 = x28 + x12
220 sub r2, r6, r2, asl #1 @ x28 - x12
221 add r7, r7, r3 @ y29 = x29 + x13
222 sub r3, r7, r3, asl #1 @ x29 - x13
223 add r8, r8, r4 @ y30 = x30 + x14
224 sub r4, r8, r4, asl #1 @ x30 - x14
225 add r9, r9, r5 @ y31 = x31 + x15
226 sub r5, r9, r5, asl #1 @ x31 - x15
228 stmia r1, {r6, r7, r8, r9}
230 smull r10, r7, r12, r3
232 smlal r10, r7, lr, r2
233 smull r10, r6, lr, r3
234 smlal r10, r6, r12, r2
240 stmia r0, {r6, r7, r8, r9}
250 ldmia sp!, {r4-r11, pc}
252 @ mdct_butterfly_generic_loop(x1, x2, T0, step, Ttop)
253 mdct_butterfly_generic_loop:
254 stmdb sp!, {r4-r11, lr}
258 ldmdb r0, {r6, r7, r8, r9}
259 ldmdb r1, {r10, r11, r12, r14}
262 sub r10, r6, r10, asl #1
264 rsb r11, r7, r11, asl #1
266 sub r12, r8, r12, asl #1
268 rsb r14, r9, r14, asl #1
270 stmdb r0!, {r6, r7, r8, r9}
273 smull r5, r8, r6, r14
275 smlal r5, r8, r7, r12
276 smull r5, r9, r6, r12
277 smlal r5, r9, r7, r14
282 add r2, r2, r3, asl #2
285 smull r5, r8, r6, r11
287 smlal r5, r8, r7, r10
288 smull r5, r9, r6, r10
289 smlal r5, r9, r7, r11
294 add r2, r2, r3, asl #2
301 ldmdb r0, {r6, r7, r8, r9}
302 ldmdb r1, {r10, r11, r12, r14}
305 sub r10, r6, r10, asl #1
307 sub r11, r7, r11, asl #1
309 sub r12, r8, r12, asl #1
311 sub r14, r9, r14, asl #1
313 stmdb r0!, {r6, r7, r8, r9}
316 smull r5, r9, r6, r14
318 smlal r5, r9, r7, r12
319 smull r5, r8, r6, r12
320 smlal r5, r8, r7, r14
325 sub r2, r2, r3, asl #2
328 smull r5, r9, r6, r11
330 smlal r5, r9, r7, r10
331 smull r5, r8, r6, r10
332 smlal r5, r8, r7, r11
337 sub r2, r2, r3, asl #2
344 ldmdb r0, {r6, r7, r8, r9}
345 ldmdb r1, {r10, r11, r12, r14}
348 rsb r10, r6, r10, asl #1
350 rsb r11, r7, r11, asl #1
352 rsb r12, r8, r12, asl #1
354 rsb r14, r9, r14, asl #1
356 stmdb r0!, {r6, r7, r8, r9}
359 smull r5, r8, r6, r12
361 smlal r5, r8, r7, r14
362 smull r5, r9, r6, r14
363 smlal r5, r9, r7, r12
368 add r2, r2, r3, asl #2
371 smull r5, r8, r6, r10
373 smlal r5, r8, r7, r11
374 smull r5, r9, r6, r11
375 smlal r5, r9, r7, r10
380 add r2, r2, r3, asl #2
387 ldmdb r0, {r6, r7, r8, r9}
388 ldmdb r1, {r10, r11, r12, r14}
391 sub r10, r6, r10, asl #1
393 rsb r11, r7, r11, asl #1
395 sub r12, r8, r12, asl #1
397 rsb r14, r9, r14, asl #1
399 stmdb r0!, {r6, r7, r8, r9}
402 smull r5, r9, r6, r12
403 smlal r5, r9, r7, r14
405 smull r5, r8, r6, r14
406 smlal r5, r8, r7, r12
411 sub r2, r2, r3, asl #2
414 smull r5, r9, r6, r10
416 smlal r5, r9, r7, r11
417 smull r5, r8, r6, r11
418 smlal r5, r8, r7, r10
423 sub r2, r2, r3, asl #2
428 ldmia sp!, {r4-r11, pc}