00a7f20c1e1e157b11f215bfc45ae7f76273f15f
[ffmpeg.git] / libavcodec / mips / mpegaudiodsp_mips_float.c
1 /*
2  * Copyright (c) 2012
3  *      MIPS Technologies, Inc., California.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
14  *    contributors may be used to endorse or promote products derived from
15  *    this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * Author:  Bojan Zivkovic (bojan@mips.com)
30  *
31  * MPEG Audio decoder optimized for MIPS floating-point architecture
32  *
33  * This file is part of FFmpeg.
34  *
35  * FFmpeg is free software; you can redistribute it and/or
36  * modify it under the terms of the GNU Lesser General Public
37  * License as published by the Free Software Foundation; either
38  * version 2.1 of the License, or (at your option) any later version.
39  *
40  * FFmpeg is distributed in the hope that it will be useful,
41  * but WITHOUT ANY WARRANTY; without even the implied warranty of
42  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
43  * Lesser General Public License for more details.
44  *
45  * You should have received a copy of the GNU Lesser General Public
46  * License along with FFmpeg; if not, write to the Free Software
47  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48  */
49
50 /**
51  * @file
52  * Reference: libavcodec/mpegaudiodsp_template.c
53  *            libavcodec/dct32.c
54  */
55
56 #include <string.h>
57
58 #include "libavcodec/mpegaudiodsp.h"
59
60 static void ff_mpadsp_apply_window_mips_float(float *synth_buf, float *window,
61                                int *dither_state, float *samples, int incr)
62 {
63     register const float *w, *w2, *p;
64     int j;
65     float *samples2;
66     float sum, sum2;
67     /* temporary variables */
68     int incr1 = incr << 2;
69     int t_sample;
70     float in1, in2, in3, in4, in5, in6, in7, in8;
71     float *p2;
72
73     /* copy to avoid wrap */
74     memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf));
75
76     /**
77     * instructions are scheduled to minimize pipeline stall.
78     * use of round_sample function from the original code is
79     * changed with appropriate assembly instructions.
80     */
81
82     __asm__ volatile (
83         "lwc1    %[sum],      0(%[dither_state])                            \t\n"
84         "sll     %[t_sample], %[incr1],     5                               \t\n"
85         "sub     %[t_sample], %[t_sample],  %[incr1]                        \n\t"
86         "li      %[j],        4                                             \t\n"
87         "lwc1    %[in1],      0(%[window])                                  \t\n"
88         "lwc1    %[in2],      16*4(%[synth_buf])                            \t\n"
89         "sw      $zero,       0(%[dither_state])                            \t\n"
90         "lwc1    %[in3],      64*4(%[window])                               \t\n"
91         "lwc1    %[in4],      80*4(%[synth_buf])                            \t\n"
92         "addu    %[samples2], %[samples],   %[t_sample]                     \t\n"
93         "madd.s  %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
94         "lwc1    %[in5],      128*4(%[window])                              \t\n"
95         "lwc1    %[in6],      144*4(%[synth_buf])                           \t\n"
96         "lwc1    %[in7],      192*4(%[window])                              \t\n"
97         "madd.s  %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
98         "lwc1    %[in8],      208*4(%[synth_buf])                           \t\n"
99         "lwc1    %[in1],      256*4(%[window])                              \t\n"
100         "lwc1    %[in2],      272*4(%[synth_buf])                           \t\n"
101         "madd.s  %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
102         "lwc1    %[in3],      320*4(%[window])                              \t\n"
103         "lwc1    %[in4],      336*4(%[synth_buf])                           \t\n"
104         "lwc1    %[in5],      384*4(%[window])                              \t\n"
105         "madd.s  %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
106         "lwc1    %[in6],      400*4(%[synth_buf])                           \t\n"
107         "lwc1    %[in7],      448*4(%[window])                              \t\n"
108         "lwc1    %[in8],      464*4(%[synth_buf])                           \t\n"
109         "madd.s  %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
110         "lwc1    %[in1],      32*4(%[window])                               \t\n"
111         "lwc1    %[in2],      48*4(%[synth_buf])                            \t\n"
112         "madd.s  %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
113         "lwc1    %[in3],      96*4(%[window])                               \t\n"
114         "lwc1    %[in4],      112*4(%[synth_buf])                           \t\n"
115         "madd.s  %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
116         "lwc1    %[in5],      160*4(%[window])                              \t\n"
117         "lwc1    %[in6],      176*4(%[synth_buf])                           \t\n"
118         "madd.s  %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
119         "lwc1    %[in7],      224*4(%[window])                              \t\n"
120         "lwc1    %[in8],      240*4(%[synth_buf])                           \t\n"
121         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
122         "lwc1    %[in1],      288*4(%[window])                              \t\n"
123         "lwc1    %[in2],      304*4(%[synth_buf])                           \t\n"
124         "nmsub.s %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
125         "lwc1    %[in3],      352*4(%[window])                              \t\n"
126         "lwc1    %[in4],      368*4(%[synth_buf])                           \t\n"
127         "nmsub.s %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
128         "lwc1    %[in5],      416*4(%[window])                              \t\n"
129         "lwc1    %[in6],      432*4(%[synth_buf])                           \t\n"
130         "nmsub.s %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
131         "lwc1    %[in7],      480*4(%[window])                              \t\n"
132         "lwc1    %[in8],      496*4(%[synth_buf])                           \t\n"
133         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
134         "addu    %[w],        %[window],    4                               \t\n"
135         "nmsub.s %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
136         "addu    %[w2],       %[window],    124                             \t\n"
137         "addiu   %[p],        %[synth_buf], 68                              \t\n"
138         "addiu   %[p2],       %[synth_buf], 188                             \t\n"
139         "nmsub.s %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
140         "nmsub.s %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
141         "swc1    %[sum],      0(%[samples])                                 \t\n"
142         "addu    %[samples],  %[samples],   %[incr1]                        \t\n"
143
144         /* calculate two samples at the same time to avoid one memory
145            access per two sample */
146
147         "ff_mpadsp_apply_window_loop%=:                                     \t\n"
148         "lwc1    %[in1],      0(%[w])                                       \t\n"
149         "lwc1    %[in2],      0(%[p])                                       \t\n"
150         "lwc1    %[in3],      0(%[w2])                                      \t\n"
151         "lwc1    %[in4],      64*4(%[w])                                    \t\n"
152         "lwc1    %[in5],      64*4(%[p])                                    \t\n"
153         "lwc1    %[in6],      64*4(%[w2])                                   \t\n"
154         "mul.s   %[sum],      %[in1],       %[in2]                          \t\n"
155         "mul.s   %[sum2],     %[in2],       %[in3]                          \t\n"
156         "lwc1    %[in1],      128*4(%[w])                                   \t\n"
157         "lwc1    %[in2],      128*4(%[p])                                   \t\n"
158         "madd.s  %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
159         "nmadd.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
160         "lwc1    %[in3],      128*4(%[w2])                                  \t\n"
161         "lwc1    %[in4],      192*4(%[w])                                   \t\n"
162         "madd.s  %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
163         "lwc1    %[in5],      192*4(%[p])                                   \t\n"
164         "lwc1    %[in6],      192*4(%[w2])                                  \t\n"
165         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
166         "lwc1    %[in1],      256*4(%[w])                                   \t\n"
167         "lwc1    %[in2],      256*4(%[p])                                   \t\n"
168         "madd.s  %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
169         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
170         "lwc1    %[in3],      256*4(%[w2])                                  \t\n"
171         "lwc1    %[in4],      320*4(%[w])                                   \t\n"
172         "madd.s  %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
173         "lwc1    %[in5],      320*4(%[p])                                   \t\n"
174         "lwc1    %[in6],      320*4(%[w2])                                  \t\n"
175         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
176         "lwc1    %[in1],      384*4(%[w])                                   \t\n"
177         "lwc1    %[in2],      384*4(%[p])                                   \t\n"
178         "madd.s  %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
179         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
180         "lwc1    %[in3],      384*4(%[w2])                                  \t\n"
181         "lwc1    %[in4],      448*4(%[w])                                   \t\n"
182         "madd.s  %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
183         "lwc1    %[in5],      448*4(%[p])                                   \t\n"
184         "lwc1    %[in6],      448*4(%[w2])                                  \t\n"
185         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
186         "madd.s  %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
187         "lwc1    %[in1],      32*4(%[w])                                    \t\n"
188         "lwc1    %[in2],      0(%[p2])                                      \t\n"
189         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
190         "lwc1    %[in3],      32*4(%[w2])                                   \t\n"
191         "lwc1    %[in4],      96*4(%[w])                                    \t\n"
192         "lwc1    %[in5],      64*4(%[p2])                                   \t\n"
193         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
194         "lwc1    %[in6],      96*4(%[w2])                                   \t\n"
195         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
196         "lwc1    %[in1],      160*4(%[w])                                   \t\n"
197         "nmsub.s %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
198         "lwc1    %[in2],      128*4(%[p2])                                  \t\n"
199         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
200         "lwc1    %[in3],      160*4(%[w2])                                  \t\n"
201         "lwc1    %[in4],      224*4(%[w])                                   \t\n"
202         "lwc1    %[in5],      192*4(%[p2])                                  \t\n"
203         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
204         "lwc1    %[in6],      224*4(%[w2])                                  \t\n"
205         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
206         "lwc1    %[in1],      288*4(%[w])                                   \t\n"
207         "nmsub.s %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
208         "lwc1    %[in2],      256*4(%[p2])                                  \t\n"
209         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
210         "lwc1    %[in3],      288*4(%[w2])                                  \t\n"
211         "lwc1    %[in4],      352*4(%[w])                                   \t\n"
212         "lwc1    %[in5],      320*4(%[p2])                                  \t\n"
213         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
214         "lwc1    %[in6],      352*4(%[w2])                                  \t\n"
215         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
216         "lwc1    %[in1],      416*4(%[w])                                   \t\n"
217         "nmsub.s %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
218         "lwc1    %[in2],      384*4(%[p2])                                  \t\n"
219         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
220         "lwc1    %[in3],      416*4(%[w2])                                  \t\n"
221         "lwc1    %[in4],      480*4(%[w])                                   \t\n"
222         "lwc1    %[in5],      448*4(%[p2])                                  \t\n"
223         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
224         "lwc1    %[in6],      480*4(%[w2])                                  \t\n"
225         "nmsub.s %[sum2],     %[sum2],      %[in2], %[in3]                  \t\n"
226         "addiu   %[w],        %[w],         4                               \t\n"
227         "nmsub.s %[sum],      %[sum],       %[in4], %[in5]                  \t\n"
228         "addiu   %[w2],       %[w2],        -4                              \t\n"
229         "nmsub.s %[sum2],     %[sum2],      %[in5], %[in6]                  \t\n"
230         "addu    %[j],        %[j],         4                               \t\n"
231         "addiu   %[p],        4                                             \t\n"
232         "swc1    %[sum],      0(%[samples])                                 \t\n"
233         "addiu   %[p2],       -4                                            \t\n"
234         "swc1    %[sum2],     0(%[samples2])                                \t\n"
235         "addu    %[samples],  %[samples],   %[incr1]                        \t\n"
236         "subu    %[samples2], %[samples2],  %[incr1]                        \t\n"
237         "bne     %[j],        64,           ff_mpadsp_apply_window_loop%=   \t\n"
238
239         "lwc1    %[in1],      48*4(%[window])                               \t\n"
240         "lwc1    %[in2],      32*4(%[synth_buf])                            \t\n"
241         "lwc1    %[in3],      112*4(%[window])                              \t\n"
242         "lwc1    %[in4],      96*4(%[synth_buf])                            \t\n"
243         "lwc1    %[in5],      176*4(%[window])                              \t\n"
244         "lwc1    %[in6],      160*4(%[synth_buf])                           \t\n"
245         "mul.s   %[sum],      %[in1],       %[in2]                          \t\n"
246         "lwc1    %[in7],      240*4(%[window])                              \t\n"
247         "lwc1    %[in8],      224*4(%[synth_buf])                           \t\n"
248         "lwc1    %[in1],      304*4(%[window])                              \t\n"
249         "nmadd.s %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
250         "lwc1    %[in2],      288*4(%[synth_buf])                           \t\n"
251         "lwc1    %[in3],      368*4(%[window])                              \t\n"
252         "lwc1    %[in4],      352*4(%[synth_buf])                           \t\n"
253         "nmsub.s %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
254         "nmsub.s %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
255         "lwc1    %[in5],      432*4(%[window])                              \t\n"
256         "lwc1    %[in6],      416*4(%[synth_buf])                           \t\n"
257         "nmsub.s %[sum],      %[sum],       %[in1], %[in2]                  \t\n"
258         "lwc1    %[in7],      496*4(%[window])                              \t\n"
259         "lwc1    %[in8],      480*4(%[synth_buf])                           \t\n"
260         "nmsub.s %[sum],      %[sum],       %[in3], %[in4]                  \t\n"
261         "nmsub.s %[sum],      %[sum],       %[in5], %[in6]                  \t\n"
262         "nmsub.s %[sum],      %[sum],       %[in7], %[in8]                  \t\n"
263         "swc1    %[sum],      0(%[samples])                                 \t\n"
264
265         : [sum] "=&f" (sum), [sum2] "=&f" (sum2),
266           [w2] "=&r" (w2),   [w] "=&r" (w),
267           [p] "=&r" (p), [p2] "=&r" (p2), [j] "=&r" (j),
268           [samples] "+r" (samples), [samples2] "=&r" (samples2),
269           [in1] "=&f" (in1), [in2] "=&f" (in2),
270           [in3] "=&f" (in3), [in4] "=&f" (in4),
271           [in5] "=&f" (in5), [in6] "=&f" (in6),
272           [in7] "=&f" (in7), [in8] "=&f" (in8),
273           [t_sample] "=&r" (t_sample)
274         : [synth_buf] "r" (synth_buf), [window] "r" (window),
275           [dither_state] "r" (dither_state), [incr1] "r" (incr1)
276     );
277 }
278
279 static void ff_dct32_mips_float(float *out, const float *tab)
280 {
281     float val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7,
282           val8 , val9 , val10, val11, val12, val13, val14, val15,
283           val16, val17, val18, val19, val20, val21, val22, val23,
284           val24, val25, val26, val27, val28, val29, val30, val31;
285     float fTmp1, fTmp2, fTmp3, fTmp4, fTmp5, fTmp6, fTmp7, fTmp8,
286           fTmp9, fTmp10, fTmp11;
287
288     /**
289     * instructions are scheduled to minimize pipeline stall.
290     */
291     __asm__ volatile (
292         "lwc1       %[fTmp1],       0*4(%[tab])                             \n\t"
293         "lwc1       %[fTmp2],       31*4(%[tab])                            \n\t"
294         "lwc1       %[fTmp3],       15*4(%[tab])                            \n\t"
295         "lwc1       %[fTmp4],       16*4(%[tab])                            \n\t"
296         "li.s       %[fTmp7],       0.50241928618815570551                  \n\t"
297         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
298         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
299         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
300         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
301         "li.s       %[fTmp10],      0.50060299823519630134                  \n\t"
302         "li.s       %[fTmp11],      10.19000812354805681150                 \n\t"
303         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
304         "add.s      %[val0],        %[fTmp5],       %[fTmp6]                \n\t"
305         "sub.s      %[val15],       %[fTmp5],       %[fTmp6]                \n\t"
306         "lwc1       %[fTmp1],       7*4(%[tab])                             \n\t"
307         "lwc1       %[fTmp2],       24*4(%[tab])                            \n\t"
308         "madd.s     %[val16],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
309         "nmsub.s    %[val31],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
310         "mul.s      %[val15],       %[val15],       %[fTmp7]                \n\t"
311         "lwc1       %[fTmp3],       8*4(%[tab])                             \n\t"
312         "lwc1       %[fTmp4],       23*4(%[tab])                            \n\t"
313         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
314         "mul.s      %[val31],       %[val31],       %[fTmp7]                \n\t"
315         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
316         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
317         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
318         "li.s       %[fTmp7],       5.10114861868916385802                  \n\t"
319         "li.s       %[fTmp10],      0.67480834145500574602                  \n\t"
320         "li.s       %[fTmp11],      0.74453627100229844977                  \n\t"
321         "add.s      %[val7],        %[fTmp5],       %[fTmp6]                \n\t"
322         "sub.s      %[val8],        %[fTmp5],       %[fTmp6]                \n\t"
323         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
324         "li.s       %[fTmp1],       0.50979557910415916894                  \n\t"
325         "sub.s      %[fTmp2],       %[val0],        %[val7]                 \n\t"
326         "mul.s      %[val8],        %[val8],        %[fTmp7]                \n\t"
327         "madd.s     %[val23],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
328         "nmsub.s    %[val24],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
329         "add.s      %[val0],        %[val0],        %[val7]                 \n\t"
330         "mul.s      %[val7],        %[fTmp1],       %[fTmp2]                \n\t"
331         "sub.s      %[fTmp2],       %[val15],       %[val8]                 \n\t"
332         "add.s      %[val8],        %[val15],       %[val8]                 \n\t"
333         "mul.s      %[val24],       %[val24],       %[fTmp7]                \n\t"
334         "sub.s      %[fTmp3],       %[val16],       %[val23]                \n\t"
335         "add.s      %[val16],       %[val16],       %[val23]                \n\t"
336         "mul.s      %[val15],       %[fTmp1],       %[fTmp2]                \n\t"
337         "sub.s      %[fTmp4],       %[val31],       %[val24]                \n\t"
338         "mul.s      %[val23],       %[fTmp1],       %[fTmp3]                \n\t"
339         "add.s      %[val24],       %[val31],       %[val24]                \n\t"
340         "mul.s      %[val31],       %[fTmp1],       %[fTmp4]                \n\t"
341
342         : [fTmp1]  "=&f" (fTmp1),  [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3),
343           [fTmp4]  "=&f" (fTmp4),  [fTmp5] "=&f" (fTmp5), [fTmp6] "=&f" (fTmp6),
344           [fTmp7]  "=&f" (fTmp7),  [fTmp8] "=&f" (fTmp8), [fTmp9] "=&f" (fTmp9),
345           [fTmp10] "=&f" (fTmp10), [fTmp11] "=&f" (fTmp11),
346           [val0]  "=f" (val0),  [val7]  "=f" (val7),
347           [val8]  "=f" (val8),  [val15] "=f" (val15),
348           [val16] "=f" (val16), [val23] "=f" (val23),
349           [val24] "=f" (val24), [val31] "=f" (val31)
350         : [tab] "r" (tab)
351     );
352
353     __asm__ volatile (
354         "lwc1       %[fTmp1],       3*4(%[tab])                             \n\t"
355         "lwc1       %[fTmp2],       28*4(%[tab])                            \n\t"
356         "lwc1       %[fTmp3],       12*4(%[tab])                            \n\t"
357         "lwc1       %[fTmp4],       19*4(%[tab])                            \n\t"
358         "li.s       %[fTmp7],       0.64682178335999012954                  \n\t"
359         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
360         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
361         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
362         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
363         "li.s       %[fTmp10],      0.53104259108978417447                  \n\t"
364         "li.s       %[fTmp11],      1.48416461631416627724                  \n\t"
365         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
366         "add.s      %[val3],        %[fTmp5],       %[fTmp6]                \n\t"
367         "sub.s      %[val12],       %[fTmp5],       %[fTmp6]                \n\t"
368         "lwc1       %[fTmp1],       4*4(%[tab])                             \n\t"
369         "lwc1       %[fTmp2],       27*4(%[tab])                            \n\t"
370         "madd.s     %[val19],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
371         "nmsub.s    %[val28],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
372         "mul.s      %[val12],       %[val12],       %[fTmp7]                \n\t"
373         "lwc1       %[fTmp3],       11*4(%[tab])                            \n\t"
374         "lwc1       %[fTmp4],       20*4(%[tab])                            \n\t"
375         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
376         "mul.s      %[val28],       %[val28],       %[fTmp7]                \n\t"
377         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
378         "li.s       %[fTmp7],       0.78815462345125022473                  \n\t"
379         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
380         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
381         "li.s       %[fTmp10],      0.55310389603444452782                  \n\t"
382         "li.s       %[fTmp11],      1.16943993343288495515                  \n\t"
383         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
384         "add.s      %[val4],        %[fTmp5],       %[fTmp6]                \n\t"
385         "sub.s      %[val11],       %[fTmp5],       %[fTmp6]                \n\t"
386         "li.s       %[fTmp1],       2.56291544774150617881                  \n\t"
387         "madd.s     %[val20],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
388         "nmsub.s    %[val27],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
389         "mul.s      %[val11],       %[val11],       %[fTmp7]                \n\t"
390         "sub.s      %[fTmp2],       %[val3],        %[val4]                 \n\t"
391         "add.s      %[val3],        %[val3],        %[val4]                 \n\t"
392         "sub.s      %[fTmp4],       %[val19],       %[val20]                \n\t"
393         "mul.s      %[val27],       %[val27],       %[fTmp7]                \n\t"
394         "sub.s      %[fTmp3],       %[val12],       %[val11]                \n\t"
395         "mul.s      %[val4],        %[fTmp1],       %[fTmp2]                \n\t"
396         "add.s      %[val11],       %[val12],       %[val11]                \n\t"
397         "add.s      %[val19],       %[val19],       %[val20]                \n\t"
398         "mul.s      %[val20],       %[fTmp1],       %[fTmp4]                \n\t"
399         "mul.s      %[val12],       %[fTmp1],       %[fTmp3]                \n\t"
400         "sub.s      %[fTmp2],       %[val28],       %[val27]                \n\t"
401         "add.s      %[val27],       %[val28],       %[val27]                \n\t"
402         "mul.s      %[val28],       %[fTmp1],       %[fTmp2]                \n\t"
403
404         : [fTmp1]  "=&f" (fTmp1),  [fTmp2]  "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3),
405           [fTmp4]  "=&f" (fTmp4),  [fTmp5]  "=&f" (fTmp5), [fTmp6] "=&f" (fTmp6),
406           [fTmp7]  "=&f" (fTmp7),  [fTmp8]  "=&f" (fTmp8), [fTmp9] "=&f" (fTmp9),
407           [fTmp10] "=&f" (fTmp10), [fTmp11] "=&f" (fTmp11),
408           [val3]  "=f" (val3),  [val4]  "=f" (val4),
409           [val11] "=f" (val11), [val12] "=f" (val12),
410           [val19] "=f" (val19), [val20] "=f" (val20),
411           [val27] "=f" (val27), [val28] "=f" (val28)
412         : [tab] "r" (tab)
413     );
414
415     __asm__ volatile (
416         "li.s       %[fTmp1],       0.54119610014619698439                  \n\t"
417         "sub.s      %[fTmp2],       %[val0],        %[val3]                 \n\t"
418         "add.s      %[val0],        %[val0],        %[val3]                 \n\t"
419         "sub.s      %[fTmp3],       %[val7],        %[val4]                 \n\t"
420         "add.s      %[val4],        %[val7],        %[val4]                 \n\t"
421         "sub.s      %[fTmp4],       %[val8],        %[val11]                \n\t"
422         "mul.s      %[val3],        %[fTmp1],       %[fTmp2]                \n\t"
423         "add.s      %[val8],        %[val8],        %[val11]                \n\t"
424         "mul.s      %[val7],        %[fTmp1],       %[fTmp3]                \n\t"
425         "sub.s      %[fTmp2],       %[val15],       %[val12]                \n\t"
426         "mul.s      %[val11],       %[fTmp1],       %[fTmp4]                \n\t"
427         "add.s      %[val12],       %[val15],       %[val12]                \n\t"
428         "mul.s      %[val15],       %[fTmp1],       %[fTmp2]                \n\t"
429
430         : [val0]  "+f" (val0),   [val3] "+f" (val3),
431           [val4]  "+f" (val4),   [val7] "+f" (val7),
432           [val8]  "+f" (val8),   [val11] "+f" (val11),
433           [val12] "+f" (val12),  [val15] "+f" (val15),
434           [fTmp1] "=f"  (fTmp1), [fTmp2] "=&f" (fTmp2),
435           [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4)
436         :
437     );
438
439     __asm__ volatile (
440         "sub.s      %[fTmp2],       %[val16],       %[val19]                \n\t"
441         "add.s      %[val16],       %[val16],       %[val19]                \n\t"
442         "sub.s      %[fTmp3],       %[val23],       %[val20]                \n\t"
443         "add.s      %[val20],       %[val23],       %[val20]                \n\t"
444         "sub.s      %[fTmp4],       %[val24],       %[val27]                \n\t"
445         "mul.s      %[val19],       %[fTmp1],       %[fTmp2]                \n\t"
446         "add.s      %[val24],       %[val24],       %[val27]                \n\t"
447         "mul.s      %[val23],       %[fTmp1],       %[fTmp3]                \n\t"
448         "sub.s      %[fTmp2],       %[val31],       %[val28]                \n\t"
449         "mul.s      %[val27],       %[fTmp1],       %[fTmp4]                \n\t"
450         "add.s      %[val28],       %[val31],       %[val28]                \n\t"
451         "mul.s      %[val31],       %[fTmp1],       %[fTmp2]                \n\t"
452
453         : [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
454           [val16] "+f" (val16), [val19] "+f" (val19), [val20] "+f" (val20),
455           [val23] "+f" (val23), [val24] "+f" (val24), [val27] "+f" (val27),
456           [val28] "+f" (val28), [val31] "+f" (val31)
457         : [fTmp1] "f" (fTmp1)
458     );
459
460     __asm__ volatile (
461         "lwc1       %[fTmp1],       1*4(%[tab])                             \n\t"
462         "lwc1       %[fTmp2],       30*4(%[tab])                            \n\t"
463         "lwc1       %[fTmp3],       14*4(%[tab])                            \n\t"
464         "lwc1       %[fTmp4],       17*4(%[tab])                            \n\t"
465         "li.s       %[fTmp7],       0.52249861493968888062                  \n\t"
466         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
467         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
468         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
469         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
470         "li.s       %[fTmp10],      0.50547095989754365998                  \n\t"
471         "li.s       %[fTmp11],      3.40760841846871878570                  \n\t"
472         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
473         "add.s      %[val1],        %[fTmp5],       %[fTmp6]                \n\t"
474         "sub.s      %[val14],       %[fTmp5],       %[fTmp6]                \n\t"
475         "lwc1       %[fTmp1],       6*4(%[tab])                             \n\t"
476         "lwc1       %[fTmp2],       25*4(%[tab])                            \n\t"
477         "madd.s     %[val17],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
478         "nmsub.s    %[val30],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
479         "mul.s      %[val14],       %[val14],       %[fTmp7]                \n\t"
480         "lwc1       %[fTmp3],       9*4(%[tab])                             \n\t"
481         "lwc1       %[fTmp4],       22*4(%[tab])                            \n\t"
482         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
483         "mul.s      %[val30],       %[val30],       %[fTmp7]                \n\t"
484         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
485         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
486         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
487         "li.s       %[fTmp7],       1.72244709823833392782                  \n\t"
488         "li.s       %[fTmp10],      0.62250412303566481615                  \n\t"
489         "li.s       %[fTmp11],      0.83934964541552703873                  \n\t"
490         "add.s      %[val6],        %[fTmp5],       %[fTmp6]                \n\t"
491         "sub.s      %[val9],        %[fTmp5],       %[fTmp6]                \n\t"
492         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
493         "li.s       %[fTmp1],       0.60134488693504528054                  \n\t"
494         "sub.s      %[fTmp2],       %[val1],        %[val6]                 \n\t"
495         "add.s      %[val1],        %[val1],        %[val6]                 \n\t"
496         "mul.s      %[val9],        %[val9],        %[fTmp7]                \n\t"
497         "madd.s     %[val22],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
498         "nmsub.s    %[val25],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
499         "mul.s      %[val6],        %[fTmp1],       %[fTmp2]                \n\t"
500         "sub.s      %[fTmp2],       %[val14],       %[val9]                 \n\t"
501         "add.s      %[val9],        %[val14],       %[val9]                 \n\t"
502         "mul.s      %[val25],       %[val25],       %[fTmp7]                \n\t"
503         "sub.s      %[fTmp3],       %[val17],       %[val22]                \n\t"
504         "add.s      %[val17],       %[val17],       %[val22]                \n\t"
505         "mul.s      %[val14],       %[fTmp1],       %[fTmp2]                \n\t"
506         "sub.s      %[fTmp2],       %[val30],       %[val25]                \n\t"
507         "mul.s      %[val22],       %[fTmp1],       %[fTmp3]                \n\t"
508         "add.s      %[val25],       %[val30],       %[val25]                \n\t"
509         "mul.s      %[val30],       %[fTmp1],       %[fTmp2]                \n\t"
510
511         : [fTmp1]  "=&f" (fTmp1),  [fTmp2]  "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3),
512           [fTmp4]  "=&f" (fTmp4),  [fTmp5]  "=&f" (fTmp5), [fTmp6] "=&f" (fTmp6),
513           [fTmp7]  "=&f" (fTmp7),  [fTmp8]  "=&f" (fTmp8), [fTmp9] "=&f" (fTmp9),
514           [fTmp10] "=&f" (fTmp10), [fTmp11] "=&f" (fTmp11),
515           [val1]  "=f" (val1),  [val6]  "=f" (val6),
516           [val9]  "=f" (val9),  [val14] "=f" (val14),
517           [val17] "=f" (val17), [val22] "=f" (val22),
518           [val25] "=f" (val25), [val30] "=f" (val30)
519         : [tab] "r" (tab)
520     );
521
522     __asm__ volatile (
523         "lwc1       %[fTmp1],       2*4(%[tab])                             \n\t"
524         "lwc1       %[fTmp2],       29*4(%[tab])                            \n\t"
525         "lwc1       %[fTmp3],       13*4(%[tab])                            \n\t"
526         "lwc1       %[fTmp4],       18*4(%[tab])                            \n\t"
527         "li.s       %[fTmp7],       0.56694403481635770368                  \n\t"
528         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
529         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
530         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
531         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
532         "li.s       %[fTmp10],      0.51544730992262454697                  \n\t"
533         "li.s       %[fTmp11],      2.05778100995341155085                  \n\t"
534         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
535         "add.s      %[val2],        %[fTmp5],       %[fTmp6]                \n\t"
536         "sub.s      %[val13],       %[fTmp5],       %[fTmp6]                \n\t"
537         "lwc1       %[fTmp1],       5*4(%[tab])                             \n\t"
538         "lwc1       %[fTmp2],       26*4(%[tab])                            \n\t"
539         "madd.s     %[val18],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
540         "nmsub.s    %[val29],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
541         "mul.s      %[val13],       %[val13],       %[fTmp7]                \n\t"
542         "lwc1       %[fTmp3],       10*4(%[tab])                            \n\t"
543         "lwc1       %[fTmp4],       21*4(%[tab])                            \n\t"
544         "mul.s      %[val29],       %[val29],       %[fTmp7]                \n\t"
545         "add.s      %[fTmp5],       %[fTmp1],       %[fTmp2]                \n\t"
546         "sub.s      %[fTmp8],       %[fTmp1],       %[fTmp2]                \n\t"
547         "add.s      %[fTmp6],       %[fTmp3],       %[fTmp4]                \n\t"
548         "sub.s      %[fTmp9],       %[fTmp3],       %[fTmp4]                \n\t"
549         "li.s       %[fTmp7],       1.06067768599034747134                  \n\t"
550         "li.s       %[fTmp10],      0.58293496820613387367                  \n\t"
551         "li.s       %[fTmp11],      0.97256823786196069369                  \n\t"
552         "add.s      %[val5],        %[fTmp5],       %[fTmp6]                \n\t"
553         "sub.s      %[val10],       %[fTmp5],       %[fTmp6]                \n\t"
554         "mul.s      %[fTmp8],       %[fTmp8],       %[fTmp10]               \n\t"
555         "li.s       %[fTmp1],       0.89997622313641570463                  \n\t"
556         "sub.s      %[fTmp2],       %[val2],        %[val5]                 \n\t"
557         "mul.s      %[val10],       %[val10],       %[fTmp7]                \n\t"
558         "madd.s     %[val21],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
559         "nmsub.s    %[val26],       %[fTmp8],       %[fTmp9],   %[fTmp11]   \n\t"
560         "add.s      %[val2],        %[val2],        %[val5]                 \n\t"
561         "mul.s      %[val5],        %[fTmp1],       %[fTmp2]                \n\t"
562         "sub.s      %[fTmp3],       %[val13],       %[val10]                \n\t"
563         "add.s      %[val10],       %[val13],       %[val10]                \n\t"
564         "mul.s      %[val26],       %[val26],       %[fTmp7]                \n\t"
565         "sub.s      %[fTmp4],       %[val18],       %[val21]                \n\t"
566         "add.s      %[val18],       %[val18],       %[val21]                \n\t"
567         "mul.s      %[val13],       %[fTmp1],       %[fTmp3]                \n\t"
568         "sub.s      %[fTmp2],       %[val29],       %[val26]                \n\t"
569         "add.s      %[val26],       %[val29],       %[val26]                \n\t"
570         "mul.s      %[val21],       %[fTmp1],       %[fTmp4]                \n\t"
571         "mul.s      %[val29],       %[fTmp1],       %[fTmp2]                \n\t"
572
573         : [fTmp1]  "=&f" (fTmp1),  [fTmp2]  "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3),
574           [fTmp4]  "=&f" (fTmp4),  [fTmp5]  "=&f" (fTmp5), [fTmp6] "=&f" (fTmp6),
575           [fTmp7]  "=&f" (fTmp7),  [fTmp8]  "=&f" (fTmp8), [fTmp9] "=&f" (fTmp9),
576           [fTmp10] "=&f" (fTmp10), [fTmp11] "=&f" (fTmp11),
577           [val2]  "=f" (val2),  [val5]  "=f" (val5),
578           [val10] "=f" (val10), [val13] "=f" (val13),
579           [val18] "=f" (val18), [val21] "=f" (val21),
580           [val26] "=f" (val26), [val29] "=f" (val29)
581         : [tab] "r" (tab)
582     );
583
584     __asm__ volatile (
585         "li.s       %[fTmp1],       1.30656296487637652785                  \n\t"
586         "sub.s      %[fTmp2],       %[val1],        %[val2]                 \n\t"
587         "add.s      %[val1],        %[val1],        %[val2]                 \n\t"
588         "sub.s      %[fTmp3],       %[val6],        %[val5]                 \n\t"
589         "add.s      %[val5],        %[val6],        %[val5]                 \n\t"
590         "sub.s      %[fTmp4],       %[val9],        %[val10]                \n\t"
591         "mul.s      %[val2],        %[fTmp1],       %[fTmp2]                \n\t"
592         "add.s      %[val9],        %[val9],        %[val10]                \n\t"
593         "mul.s      %[val6],        %[fTmp1],       %[fTmp3]                \n\t"
594         "sub.s      %[fTmp2],       %[val14],       %[val13]                \n\t"
595         "mul.s      %[val10],       %[fTmp1],       %[fTmp4]                \n\t"
596         "add.s      %[val13],       %[val14],       %[val13]                \n\t"
597         "mul.s      %[val14],       %[fTmp1],       %[fTmp2]                \n\t"
598
599         : [fTmp1] "=f"  (fTmp1), [fTmp2] "=&f" (fTmp2),
600           [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
601           [val1]  "+f" (val1),  [val2]  "+f" (val2),
602           [val5]  "+f" (val5),  [val6]  "+f" (val6),
603           [val9]  "+f" (val9),  [val10] "+f" (val10),
604           [val13] "+f" (val13), [val14] "+f" (val14)
605         :
606     );
607
608     __asm__ volatile (
609         "sub.s      %[fTmp2],       %[val17],       %[val18]                \n\t"
610         "add.s      %[val17],       %[val17],       %[val18]                \n\t"
611         "sub.s      %[fTmp3],       %[val22],       %[val21]                \n\t"
612         "add.s      %[val21],       %[val22],       %[val21]                \n\t"
613         "sub.s      %[fTmp4],       %[val25],       %[val26]                \n\t"
614         "mul.s      %[val18],       %[fTmp1],       %[fTmp2]                \n\t"
615         "add.s      %[val25],       %[val25],       %[val26]                \n\t"
616         "mul.s      %[val22],       %[fTmp1],       %[fTmp3]                \n\t"
617         "sub.s      %[fTmp2],       %[val30],       %[val29]                \n\t"
618         "mul.s      %[val26],       %[fTmp1],       %[fTmp4]                \n\t"
619         "add.s      %[val29],       %[val30],       %[val29]                \n\t"
620         "mul.s      %[val30],       %[fTmp1],       %[fTmp2]                \n\t"
621
622         : [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
623           [val17] "+f" (val17), [val18] "+f" (val18), [val21] "+f" (val21),
624           [val22] "+f" (val22), [val25] "+f" (val25), [val26] "+f" (val26),
625           [val29] "+f" (val29), [val30] "+f" (val30)
626         : [fTmp1] "f" (fTmp1)
627     );
628
629     __asm__ volatile (
630         "li.s       %[fTmp1],       0.70710678118654752439                  \n\t"
631         "sub.s      %[fTmp2],       %[val0],        %[val1]                 \n\t"
632         "add.s      %[val0],        %[val0],        %[val1]                 \n\t"
633         "sub.s      %[fTmp3],       %[val3],        %[val2]                 \n\t"
634         "add.s      %[val2],        %[val3],        %[val2]                 \n\t"
635         "sub.s      %[fTmp4],       %[val4],        %[val5]                 \n\t"
636         "mul.s      %[val1],        %[fTmp1],       %[fTmp2]                \n\t"
637         "swc1       %[val0],        0(%[out])                               \n\t"
638         "mul.s      %[val3],        %[fTmp3],       %[fTmp1]                \n\t"
639         "add.s      %[val4],        %[val4],        %[val5]                 \n\t"
640         "mul.s      %[val5],        %[fTmp1],       %[fTmp4]                \n\t"
641         "swc1       %[val1],        16*4(%[out])                            \n\t"
642         "sub.s      %[fTmp2],       %[val7],        %[val6]                 \n\t"
643         "add.s      %[val2],        %[val2],        %[val3]                 \n\t"
644         "swc1       %[val3],        24*4(%[out])                            \n\t"
645         "add.s      %[val6],        %[val7],        %[val6]                 \n\t"
646         "mul.s      %[val7],        %[fTmp1],       %[fTmp2]                \n\t"
647         "swc1       %[val2],        8*4(%[out])                             \n\t"
648         "add.s      %[val6],        %[val6],        %[val7]                 \n\t"
649         "swc1       %[val7],        28*4(%[out])                            \n\t"
650         "add.s      %[val4],        %[val4],        %[val6]                 \n\t"
651         "add.s      %[val6],        %[val6],        %[val5]                 \n\t"
652         "add.s      %[val5],        %[val5],        %[val7]                 \n\t"
653         "swc1       %[val4],        4*4(%[out])                             \n\t"
654         "swc1       %[val5],        20*4(%[out])                            \n\t"
655         "swc1       %[val6],        12*4(%[out])                            \n\t"
656
657         : [fTmp1] "=f"  (fTmp1), [fTmp2] "=&f" (fTmp2),
658           [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
659           [val0] "+f" (val0), [val1] "+f" (val1),
660           [val2] "+f" (val2), [val3] "+f" (val3),
661           [val4] "+f" (val4), [val5] "+f" (val5),
662           [val6] "+f" (val6), [val7] "+f" (val7)
663         : [out] "r" (out)
664     );
665
666     __asm__ volatile (
667         "sub.s      %[fTmp2],       %[val8],        %[val9]                 \n\t"
668         "add.s      %[val8],        %[val8],        %[val9]                 \n\t"
669         "sub.s      %[fTmp3],       %[val11],       %[val10]                \n\t"
670         "add.s      %[val10],       %[val11],       %[val10]                \n\t"
671         "sub.s      %[fTmp4],       %[val12],       %[val13]                \n\t"
672         "mul.s      %[val9],        %[fTmp1],       %[fTmp2]                \n\t"
673         "add.s      %[val12],       %[val12],       %[val13]                \n\t"
674         "mul.s      %[val11],       %[fTmp1],       %[fTmp3]                \n\t"
675         "sub.s      %[fTmp2],       %[val15],       %[val14]                \n\t"
676         "mul.s      %[val13],       %[fTmp1],       %[fTmp4]                \n\t"
677         "add.s      %[val14],       %[val15],       %[val14]                \n\t"
678         "add.s      %[val10],       %[val10],       %[val11]                \n\t"
679         "mul.s      %[val15],       %[fTmp1],       %[fTmp2]                \n\t"
680         "add.s      %[val14],       %[val14],       %[val15]                \n\t"
681         "add.s      %[val12],       %[val12],       %[val14]                \n\t"
682         "add.s      %[val14],       %[val14],       %[val13]                \n\t"
683         "add.s      %[val13],       %[val13],       %[val15]                \n\t"
684         "add.s      %[val8],        %[val8],        %[val12]                \n\t"
685         "add.s      %[val12],       %[val12],       %[val10]                \n\t"
686         "add.s      %[val10],       %[val10],       %[val14]                \n\t"
687         "add.s      %[val14],       %[val14],       %[val9]                 \n\t"
688         "add.s      %[val9],        %[val9],        %[val13]                \n\t"
689         "add.s      %[val13],       %[val13],       %[val11]                \n\t"
690         "add.s      %[val11],       %[val11],       %[val15]                \n\t"
691         "swc1       %[val8],         2*4(%[out])                            \n\t"
692         "swc1       %[val9],        18*4(%[out])                            \n\t"
693         "swc1       %[val10],       10*4(%[out])                            \n\t"
694         "swc1       %[val11],       26*4(%[out])                            \n\t"
695         "swc1       %[val12],        6*4(%[out])                            \n\t"
696         "swc1       %[val13],       22*4(%[out])                            \n\t"
697         "swc1       %[val14],       14*4(%[out])                            \n\t"
698         "swc1       %[val15],       30*4(%[out])                            \n\t"
699
700         : [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
701           [val8]  "+f" (val8),  [val9]  "+f" (val9),  [val10] "+f" (val10),
702           [val11] "+f" (val11), [val12] "+f" (val12), [val13] "+f" (val13),
703           [val14] "+f" (val14), [val15] "+f" (val15)
704         : [fTmp1] "f" (fTmp1), [out] "r" (out)
705     );
706
707     __asm__ volatile (
708         "sub.s      %[fTmp2],       %[val16],       %[val17]                \n\t"
709         "add.s      %[val16],       %[val16],       %[val17]                \n\t"
710         "sub.s      %[fTmp3],       %[val19],       %[val18]                \n\t"
711         "add.s      %[val18],       %[val19],       %[val18]                \n\t"
712         "sub.s      %[fTmp4],       %[val20],       %[val21]                \n\t"
713         "mul.s      %[val17],       %[fTmp1],       %[fTmp2]                \n\t"
714         "add.s      %[val20],       %[val20],       %[val21]                \n\t"
715         "mul.s      %[val19],       %[fTmp1],       %[fTmp3]                \n\t"
716         "sub.s      %[fTmp2],       %[val23],       %[val22]                \n\t"
717         "mul.s      %[val21],       %[fTmp1],       %[fTmp4]                \n\t"
718         "add.s      %[val22],       %[val23],       %[val22]                \n\t"
719         "add.s      %[val18],       %[val18],       %[val19]                \n\t"
720         "mul.s      %[val23],       %[fTmp1],       %[fTmp2]                \n\t"
721         "add.s      %[val22],       %[val22],       %[val23]                \n\t"
722         "add.s      %[val20],       %[val20],       %[val22]                \n\t"
723         "add.s      %[val22],       %[val22],       %[val21]                \n\t"
724         "add.s      %[val21],       %[val21],       %[val23]                \n\t"
725
726         : [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
727           [val16] "+f" (val16), [val17] "+f" (val17), [val18] "+f" (val18),
728           [val19] "+f" (val19), [val20] "+f" (val20), [val21] "+f" (val21),
729           [val22] "+f" (val22), [val23] "+f" (val23)
730         : [fTmp1] "f" (fTmp1)
731     );
732
733     __asm__ volatile (
734         "sub.s      %[fTmp2],       %[val24],       %[val25]                \n\t"
735         "add.s      %[val24],       %[val24],       %[val25]                \n\t"
736         "sub.s      %[fTmp3],       %[val27],       %[val26]                \n\t"
737         "add.s      %[val26],       %[val27],       %[val26]                \n\t"
738         "sub.s      %[fTmp4],       %[val28],       %[val29]                \n\t"
739         "mul.s      %[val25],       %[fTmp1],       %[fTmp2]                \n\t"
740         "add.s      %[val28],       %[val28],       %[val29]                \n\t"
741         "mul.s      %[val27],       %[fTmp1],       %[fTmp3]                \n\t"
742         "sub.s      %[fTmp2],       %[val31],       %[val30]                \n\t"
743         "mul.s      %[val29],       %[fTmp1],       %[fTmp4]                \n\t"
744         "add.s      %[val30],       %[val31],       %[val30]                \n\t"
745         "add.s      %[val26],       %[val26],       %[val27]                \n\t"
746         "mul.s      %[val31],       %[fTmp1],       %[fTmp2]                \n\t"
747         "add.s      %[val30],       %[val30],       %[val31]                \n\t"
748         "add.s      %[val28],       %[val28],       %[val30]                \n\t"
749         "add.s      %[val30],       %[val30],       %[val29]                \n\t"
750         "add.s      %[val29],       %[val29],       %[val31]                \n\t"
751         "add.s      %[val24],       %[val24],       %[val28]                \n\t"
752         "add.s      %[val28],       %[val28],       %[val26]                \n\t"
753         "add.s      %[val26],       %[val26],       %[val30]                \n\t"
754         "add.s      %[val30],       %[val30],       %[val25]                \n\t"
755         "add.s      %[val25],       %[val25],       %[val29]                \n\t"
756         "add.s      %[val29],       %[val29],       %[val27]                \n\t"
757         "add.s      %[val27],       %[val27],       %[val31]                \n\t"
758
759         : [fTmp2] "=&f" (fTmp2), [fTmp3] "=&f" (fTmp3), [fTmp4] "=&f" (fTmp4),
760           [val24] "+f" (val24), [val25] "+f" (val25), [val26] "+f" (val26),
761           [val27] "+f" (val27), [val28] "+f" (val28), [val29] "+f" (val29),
762           [val30] "+f" (val30), [val31] "+f" (val31)
763         : [fTmp1] "f" (fTmp1)
764     );
765
766     out[ 1] = val16 + val24;
767     out[17] = val17 + val25;
768     out[ 9] = val18 + val26;
769     out[25] = val19 + val27;
770     out[ 5] = val20 + val28;
771     out[21] = val21 + val29;
772     out[13] = val22 + val30;
773     out[29] = val23 + val31;
774     out[ 3] = val24 + val20;
775     out[19] = val25 + val21;
776     out[11] = val26 + val22;
777     out[27] = val27 + val23;
778     out[ 7] = val28 + val18;
779     out[23] = val29 + val19;
780     out[15] = val30 + val17;
781     out[31] = val31;
782 }
783
784 static void imdct36_mips_float(float *out, float *buf, float *in, float *win)
785 {
786     float t0, t1, t2, t3, s0, s1, s2, s3;
787     float tmp[18];
788     /* temporary variables */
789     float in1, in2, in3, in4, in5, in6;
790     float out1, out2, out3, out4, out5;
791     float c1, c2, c3, c4, c5, c6, c7, c8, c9;
792
793     /**
794     * all loops are unrolled totally, and instructions are scheduled to
795     * minimize pipeline stall. instructions of the first two loops are
796     * reorganized, in order to eliminate unnecessary readings and
797     * writings into array. values defined in macros and tables are
798     * eliminated - they are directly loaded in appropriate variables
799     */
800
801     /* loop 1 and 2 */
802     __asm__ volatile (
803         "lwc1   %[in1],  17*4(%[in])                                    \t\n"
804         "lwc1   %[in2],  16*4(%[in])                                    \t\n"
805         "lwc1   %[in3],  15*4(%[in])                                    \t\n"
806         "lwc1   %[in4],  14*4(%[in])                                    \t\n"
807         "lwc1   %[in5],  13*4(%[in])                                    \t\n"
808         "lwc1   %[in6],  12*4(%[in])                                    \t\n"
809         "add.s  %[out1], %[in1],  %[in2]                                \t\n"
810         "add.s  %[out2], %[in2],  %[in3]                                \t\n"
811         "add.s  %[out3], %[in3],  %[in4]                                \t\n"
812         "add.s  %[out4], %[in4],  %[in5]                                \t\n"
813         "add.s  %[out5], %[in5],  %[in6]                                \t\n"
814         "lwc1   %[in1],  11*4(%[in])                                    \t\n"
815         "swc1   %[out2], 16*4(%[in])                                    \t\n"
816         "add.s  %[out1], %[out1], %[out3]                               \t\n"
817         "swc1   %[out4], 14*4(%[in])                                    \t\n"
818         "add.s  %[out3], %[out3], %[out5]                               \t\n"
819         "lwc1   %[in2],  10*4(%[in])                                    \t\n"
820         "lwc1   %[in3],  9*4(%[in])                                     \t\n"
821         "swc1   %[out1], 17*4(%[in])                                    \t\n"
822         "lwc1   %[in4],  8*4(%[in])                                     \t\n"
823         "swc1   %[out3], 15*4(%[in])                                    \t\n"
824         "add.s  %[out1], %[in6],  %[in1]                                \t\n"
825         "add.s  %[out2], %[in1],  %[in2]                                \t\n"
826         "add.s  %[out3], %[in2],  %[in3]                                \t\n"
827         "add.s  %[out4], %[in3],  %[in4]                                \t\n"
828         "lwc1   %[in5],  7*4(%[in])                                     \t\n"
829         "swc1   %[out1], 12*4(%[in])                                    \t\n"
830         "add.s  %[out5], %[out5], %[out2]                               \t\n"
831         "swc1   %[out3], 10*4(%[in])                                    \t\n"
832         "add.s  %[out2], %[out2], %[out4]                               \t\n"
833         "lwc1   %[in6],  6*4(%[in])                                     \t\n"
834         "lwc1   %[in1],  5*4(%[in])                                     \t\n"
835         "swc1   %[out5], 13*4(%[in])                                    \t\n"
836         "lwc1   %[in2],  4*4(%[in])                                     \t\n"
837         "swc1   %[out2], 11*4(%[in])                                    \t\n"
838         "add.s  %[out5], %[in4],  %[in5]                                \t\n"
839         "add.s  %[out1], %[in5],  %[in6]                                \t\n"
840         "add.s  %[out2], %[in6],  %[in1]                                \t\n"
841         "add.s  %[out3], %[in1],  %[in2]                                \t\n"
842         "lwc1   %[in3],  3*4(%[in])                                     \t\n"
843         "swc1   %[out5], 8*4(%[in])                                     \t\n"
844         "add.s  %[out4], %[out4], %[out1]                               \t\n"
845         "swc1   %[out2], 6*4(%[in])                                     \t\n"
846         "add.s  %[out1], %[out1], %[out3]                               \t\n"
847         "lwc1   %[in4],  2*4(%[in])                                     \t\n"
848         "lwc1   %[in5],  1*4(%[in])                                     \t\n"
849         "swc1   %[out4], 9*4(%[in])                                     \t\n"
850         "lwc1   %[in6],  0(%[in])                                       \t\n"
851         "swc1   %[out1], 7*4(%[in])                                     \t\n"
852         "add.s  %[out4], %[in2],  %[in3]                                \t\n"
853         "add.s  %[out5], %[in3],  %[in4]                                \t\n"
854         "add.s  %[out1], %[in4],  %[in5]                                \t\n"
855         "add.s  %[out2], %[in5],  %[in6]                                \t\n"
856         "swc1   %[out4], 4*4(%[in])                                     \t\n"
857         "add.s  %[out3], %[out3], %[out5]                               \t\n"
858         "swc1   %[out1], 2*4(%[in])                                     \t\n"
859         "add.s  %[out5], %[out5], %[out2]                               \t\n"
860         "swc1   %[out2], 1*4(%[in])                                     \t\n"
861         "swc1   %[out3], 5*4(%[in])                                     \t\n"
862         "swc1   %[out5], 3*4(%[in])                                     \t\n"
863
864         : [in1] "=&f" (in1), [in2] "=&f" (in2),
865           [in3] "=&f" (in3), [in4] "=&f" (in4),
866           [in5] "=&f" (in5), [in6] "=&f" (in6),
867           [out1] "=&f" (out1), [out2] "=&f" (out2),
868           [out3] "=&f" (out3), [out4] "=&f" (out4),
869           [out5] "=&f" (out5)
870         : [in] "r" (in)
871     );
872
873     /* loop 3 */
874     __asm__ volatile (
875         "li.s    %[c1],   0.5                                           \t\n"
876         "lwc1    %[in1],  8*4(%[in])                                    \t\n"
877         "lwc1    %[in2],  16*4(%[in])                                   \t\n"
878         "lwc1    %[in3],  4*4(%[in])                                    \t\n"
879         "lwc1    %[in4],  0(%[in])                                      \t\n"
880         "lwc1    %[in5],  12*4(%[in])                                   \t\n"
881         "li.s    %[c2],   0.93969262078590838405                        \t\n"
882         "add.s   %[t2],   %[in1],  %[in2]                               \t\n"
883         "add.s   %[t0],   %[in1],  %[in3]                               \t\n"
884         "li.s    %[c3],   -0.76604444311897803520                       \t\n"
885         "madd.s  %[t3],   %[in4],  %[in5], %[c1]                        \t\n"
886         "sub.s   %[t1],   %[in4],  %[in5]                               \t\n"
887         "sub.s   %[t2],   %[t2],   %[in3]                               \t\n"
888         "mul.s   %[t0],   %[t0],   %[c2]                                \t\n"
889         "li.s    %[c4],   -0.17364817766693034885                       \t\n"
890         "li.s    %[c5],   -0.86602540378443864676                       \t\n"
891         "li.s    %[c6],   0.98480775301220805936                        \t\n"
892         "nmsub.s %[out1], %[t1],   %[t2],  %[c1]                        \t\n"
893         "add.s   %[out2], %[t1],   %[t2]                                \t\n"
894         "add.s   %[t2],   %[in2],  %[in3]                               \t\n"
895         "sub.s   %[t1],   %[in1],  %[in2]                               \t\n"
896         "sub.s   %[out3], %[t3],   %[t0]                                \t\n"
897         "swc1    %[out1], 6*4(%[tmp])                                   \t\n"
898         "swc1    %[out2], 16*4(%[tmp])                                  \t\n"
899         "mul.s   %[t2],   %[t2],   %[c3]                                \t\n"
900         "mul.s   %[t1],   %[t1],   %[c4]                                \t\n"
901         "add.s   %[out1], %[t3],   %[t0]                                \t\n"
902         "lwc1    %[in1],  10*4(%[in])                                   \t\n"
903         "lwc1    %[in2],  14*4(%[in])                                   \t\n"
904         "sub.s   %[out3], %[out3], %[t2]                                \t\n"
905         "add.s   %[out2], %[t3],   %[t2]                                \t\n"
906         "add.s   %[out1], %[out1], %[t1]                                \t\n"
907         "lwc1    %[in3],  2*4(%[in])                                    \t\n"
908         "lwc1    %[in4],  6*4(%[in])                                    \t\n"
909         "swc1    %[out3], 10*4(%[tmp])                                  \t\n"
910         "sub.s   %[out2], %[out2], %[t1]                                \t\n"
911         "swc1    %[out1], 2*4(%[tmp])                                   \t\n"
912         "add.s   %[out1], %[in1],  %[in2]                               \t\n"
913         "add.s   %[t2],   %[in1],  %[in3]                               \t\n"
914         "sub.s   %[t3],   %[in1],  %[in2]                               \t\n"
915         "swc1    %[out2], 14*4(%[tmp])                                  \t\n"
916         "li.s    %[c7],   -0.34202014332566873304                       \t\n"
917         "sub.s   %[out1], %[out1], %[in3]                               \t\n"
918         "mul.s   %[t2],   %[t2],   %[c6]                                \t\n"
919         "mul.s   %[t3],   %[t3],   %[c7]                                \t\n"
920         "li.s    %[c8],   0.86602540378443864676                        \t\n"
921         "mul.s   %[t0],   %[in4],  %[c8]                                \t\n"
922         "mul.s   %[out1], %[out1], %[c5]                                \t\n"
923         "add.s   %[t1],   %[in2],  %[in3]                               \t\n"
924         "li.s    %[c9],   -0.64278760968653932632                       \t\n"
925         "add.s   %[out2], %[t2],   %[t3]                                \t\n"
926         "lwc1    %[in1],  9*4(%[in])                                    \t\n"
927         "swc1    %[out1], 4*4(%[tmp])                                   \t\n"
928         "mul.s   %[t1],   %[t1],   %[c9]                                \t\n"
929         "lwc1    %[in2],  17*4(%[in])                                   \t\n"
930         "add.s   %[out2], %[out2], %[t0]                                \t\n"
931         "lwc1    %[in3],  5*4(%[in])                                    \t\n"
932         "lwc1    %[in4],  1*4(%[in])                                    \t\n"
933         "add.s   %[out3], %[t2],   %[t1]                                \t\n"
934         "sub.s   %[out1], %[t3],   %[t1]                                \t\n"
935         "swc1    %[out2], 0(%[tmp])                                     \t\n"
936         "lwc1    %[in5],  13*4(%[in])                                   \t\n"
937         "add.s   %[t2],   %[in1],  %[in2]                               \t\n"
938         "sub.s   %[out3], %[out3], %[t0]                                \t\n"
939         "sub.s   %[out1], %[out1], %[t0]                                \t\n"
940         "add.s   %[t0],   %[in1],  %[in3]                               \t\n"
941         "madd.s  %[t3],   %[in4],  %[in5], %[c1]                        \t\n"
942         "sub.s   %[t2],   %[t2],   %[in3]                               \t\n"
943         "swc1    %[out3], 12*4(%[tmp])                                  \t\n"
944         "swc1    %[out1], 8*4(%[tmp])                                   \t\n"
945         "sub.s   %[t1],   %[in4],  %[in5]                               \t\n"
946         "mul.s   %[t0],   %[t0],   %[c2]                                \t\n"
947         "nmsub.s %[out1], %[t1],   %[t2],  %[c1]                        \t\n"
948         "add.s   %[out2], %[t1],   %[t2]                                \t\n"
949         "add.s   %[t2],   %[in2],  %[in3]                               \t\n"
950         "sub.s   %[t1],   %[in1],  %[in2]                               \t\n"
951         "sub.s   %[out3], %[t3],   %[t0]                                \t\n"
952         "swc1    %[out1], 7*4(%[tmp])                                   \t\n"
953         "swc1    %[out2], 17*4(%[tmp])                                  \t\n"
954         "mul.s   %[t2],   %[t2],   %[c3]                                \t\n"
955         "mul.s   %[t1],   %[t1],   %[c4]                                \t\n"
956         "add.s   %[out1], %[t3],   %[t0]                                \t\n"
957         "lwc1    %[in1],  11*4(%[in])                                   \t\n"
958         "lwc1    %[in2],  15*4(%[in])                                   \t\n"
959         "sub.s   %[out3], %[out3], %[t2]                                \t\n"
960         "add.s   %[out2], %[t3],   %[t2]                                \t\n"
961         "add.s   %[out1], %[out1], %[t1]                                \t\n"
962         "lwc1    %[in3],  3*4(%[in])                                    \t\n"
963         "lwc1    %[in4],  7*4(%[in])                                    \t\n"
964         "swc1    %[out3], 11*4(%[tmp])                                  \t\n"
965         "sub.s   %[out2], %[out2], %[t1]                                \t\n"
966         "swc1    %[out1], 3*4(%[tmp])                                   \t\n"
967         "add.s   %[out3], %[in1],  %[in2]                               \t\n"
968         "add.s   %[t2],   %[in1],  %[in3]                               \t\n"
969         "sub.s   %[t3],   %[in1],  %[in2]                               \t\n"
970         "swc1    %[out2], 15*4(%[tmp])                                  \t\n"
971         "mul.s   %[t0],   %[in4],  %[c8]                                \t\n"
972         "sub.s   %[out3], %[out3], %[in3]                               \t\n"
973         "mul.s   %[t2],   %[t2],   %[c6]                                \t\n"
974         "mul.s   %[t3],   %[t3],   %[c7]                                \t\n"
975         "add.s   %[t1],   %[in2],  %[in3]                               \t\n"
976         "mul.s   %[out3], %[out3], %[c5]                                \t\n"
977         "add.s   %[out1], %[t2],   %[t3]                                \t\n"
978         "mul.s   %[t1],   %[t1],   %[c9]                                \t\n"
979         "swc1    %[out3], 5*4(%[tmp])                                   \t\n"
980         "add.s   %[out1], %[out1], %[t0]                                \t\n"
981         "add.s   %[out2], %[t2],   %[t1]                                \t\n"
982         "sub.s   %[out3], %[t3],   %[t1]                                \t\n"
983         "swc1    %[out1], 1*4(%[tmp])                                   \t\n"
984         "sub.s   %[out2], %[out2], %[t0]                                \t\n"
985         "sub.s   %[out3], %[out3], %[t0]                                \t\n"
986         "swc1    %[out2], 13*4(%[tmp])                                  \t\n"
987         "swc1    %[out3], 9*4(%[tmp])                                   \t\n"
988
989         : [t0] "=&f" (t0), [t1] "=&f" (t1),
990           [t2] "=&f" (t2), [t3] "=&f" (t3),
991           [in1] "=&f" (in1), [in2] "=&f" (in2),
992           [in3] "=&f" (in3), [in4] "=&f" (in4),
993           [in5] "=&f" (in5),
994           [out1] "=&f" (out1), [out2] "=&f" (out2),
995           [out3] "=&f" (out3),
996           [c1] "=&f" (c1), [c2] "=&f" (c2),
997           [c3] "=&f" (c3), [c4] "=&f" (c4),
998           [c5] "=&f" (c5), [c6] "=&f" (c6),
999           [c7] "=&f" (c7), [c8] "=&f" (c8),
1000           [c9] "=&f" (c9)
1001         : [in] "r" (in), [tmp] "r" (tmp)
1002     );
1003
1004     /* loop 4 */
1005     __asm__ volatile (
1006         "lwc1   %[in1],  2*4(%[tmp])                                    \t\n"
1007         "lwc1   %[in2],  0(%[tmp])                                      \t\n"
1008         "lwc1   %[in3],  3*4(%[tmp])                                    \t\n"
1009         "lwc1   %[in4],  1*4(%[tmp])                                    \t\n"
1010         "li.s   %[c1],   0.50190991877167369479                         \t\n"
1011         "li.s   %[c2],   5.73685662283492756461                         \t\n"
1012         "add.s  %[s0],   %[in1], %[in2]                                 \t\n"
1013         "sub.s  %[s2],   %[in1], %[in2]                                 \t\n"
1014         "add.s  %[s1],   %[in3], %[in4]                                 \t\n"
1015         "sub.s  %[s3],   %[in3], %[in4]                                 \t\n"
1016         "lwc1   %[in1],  9*4(%[win])                                    \t\n"
1017         "lwc1   %[in2],  4*9*4(%[buf])                                  \t\n"
1018         "lwc1   %[in3],  8*4(%[win])                                    \t\n"
1019         "mul.s  %[s1],   %[s1],  %[c1]                                  \t\n"
1020         "mul.s  %[s3],   %[s3],  %[c2]                                  \t\n"
1021         "lwc1   %[in4],  4*8*4(%[buf])                                  \t\n"
1022         "lwc1   %[in5],  29*4(%[win])                                   \t\n"
1023         "lwc1   %[in6],  28*4(%[win])                                   \t\n"
1024         "add.s  %[t0],   %[s0],  %[s1]                                  \t\n"
1025         "sub.s  %[t1],   %[s0],  %[s1]                                  \t\n"
1026         "li.s   %[c1],   0.51763809020504152469                         \t\n"
1027         "li.s   %[c2],   1.93185165257813657349                         \t\n"
1028         "mul.s  %[out3], %[in5], %[t0]                                  \t\n"
1029         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1030         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1031         "mul.s  %[out4], %[in6], %[t0]                                  \t\n"
1032         "add.s  %[t0],   %[s2],  %[s3]                                  \t\n"
1033         "swc1   %[out3], 4*9*4(%[buf])                                  \t\n"
1034         "swc1   %[out1], 288*4(%[out])                                  \t\n"
1035         "swc1   %[out2], 256*4(%[out])                                  \t\n"
1036         "swc1   %[out4], 4*8*4(%[buf])                                  \t\n"
1037         "sub.s  %[t1],   %[s2],  %[s3]                                  \t\n"
1038         "lwc1   %[in1],  17*4(%[win])                                   \t\n"
1039         "lwc1   %[in2],  4*17*4(%[buf])                                 \t\n"
1040         "lwc1   %[in3],  0(%[win])                                      \t\n"
1041         "lwc1   %[in4],  0(%[buf])                                      \t\n"
1042         "lwc1   %[in5],  37*4(%[win])                                   \t\n"
1043         "lwc1   %[in6],  20*4(%[win])                                   \t\n"
1044         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1045         "lwc1   %[in1],  6*4(%[tmp])                                    \t\n"
1046         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1047         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1048         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1049         "swc1   %[out1], 544*4(%[out])                                  \t\n"
1050         "lwc1   %[in2],  4*4(%[tmp])                                    \t\n"
1051         "swc1   %[out2], 0(%[out])                                      \t\n"
1052         "swc1   %[out3], 4*17*4(%[buf])                                 \t\n"
1053         "swc1   %[out4], 0(%[buf])                                      \t\n"
1054         "lwc1   %[in3],  7*4(%[tmp])                                    \t\n"
1055         "add.s  %[s0],   %[in1], %[in2]                                 \t\n"
1056         "sub.s  %[s2],   %[in1], %[in2]                                 \t\n"
1057         "lwc1   %[in4],  5*4(%[tmp])                                    \t\n"
1058         "add.s  %[s1],   %[in3], %[in4]                                 \t\n"
1059         "sub.s  %[s3],   %[in3], %[in4]                                 \t\n"
1060         "lwc1   %[in1],  10*4(%[win])                                   \t\n"
1061         "lwc1   %[in2],  4*10*4(%[buf])                                 \t\n"
1062         "lwc1   %[in3],  7*4(%[win])                                    \t\n"
1063         "mul.s  %[s1],   %[s1],  %[c1]                                  \t\n"
1064         "mul.s  %[s3],   %[s3],  %[c2]                                  \t\n"
1065         "add.s  %[t0],   %[s0],  %[s1]                                  \t\n"
1066         "sub.s  %[t1],   %[s0],  %[s1]                                  \t\n"
1067         "lwc1   %[in4],  4*7*4(%[buf])                                  \t\n"
1068         "lwc1   %[in5],  30*4(%[win])                                   \t\n"
1069         "lwc1   %[in6],  27*4(%[win])                                   \t\n"
1070         "li.s   %[c1],   0.55168895948124587824                         \t\n"
1071         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1072         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1073         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1074         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1075         "add.s  %[t0],   %[s2],  %[s3]                                  \t\n"
1076         "swc1   %[out1], 320*4(%[out])                                  \t\n"
1077         "swc1   %[out2], 224*4(%[out])                                  \t\n"
1078         "swc1   %[out3], 4*10*4(%[buf])                                 \t\n"
1079         "swc1   %[out4], 4*7*4(%[buf])                                  \t\n"
1080         "sub.s  %[t1],   %[s2],  %[s3]                                  \t\n"
1081         "lwc1   %[in1],  16*4(%[win])                                   \t\n"
1082         "lwc1   %[in2],  4*16*4(%[buf])                                 \t\n"
1083         "lwc1   %[in3],  1*4(%[win])                                    \t\n"
1084         "lwc1   %[in4],  4*1*4(%[buf])                                  \t\n"
1085         "lwc1   %[in5],  36*4(%[win])                                   \t\n"
1086         "lwc1   %[in6],  21*4(%[win])                                   \t\n"
1087         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1088         "lwc1   %[in1],  10*4(%[tmp])                                   \t\n"
1089         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1090         "mul.s  %[out3], %[in5], %[t0]                                  \t\n"
1091         "mul.s  %[out4], %[in6], %[t0]                                  \t\n"
1092         "swc1   %[out1], 512*4(%[out])                                  \t\n"
1093         "lwc1   %[in2],  8*4(%[tmp])                                    \t\n"
1094         "swc1   %[out2], 32*4(%[out])                                   \t\n"
1095         "swc1   %[out3], 4*16*4(%[buf])                                 \t\n"
1096         "swc1   %[out4], 4*1*4(%[buf])                                  \t\n"
1097         "li.s   %[c2],   1.18310079157624925896                         \t\n"
1098         "add.s  %[s0],   %[in1], %[in2]                                 \t\n"
1099         "sub.s  %[s2],   %[in1], %[in2]                                 \t\n"
1100         "lwc1   %[in3],  11*4(%[tmp])                                   \t\n"
1101         "lwc1   %[in4],  9*4(%[tmp])                                    \t\n"
1102         "add.s  %[s1],   %[in3], %[in4]                                 \t\n"
1103         "sub.s  %[s3],   %[in3], %[in4]                                 \t\n"
1104         "lwc1   %[in1],  11*4(%[win])                                   \t\n"
1105         "lwc1   %[in2],  4*11*4(%[buf])                                 \t\n"
1106         "lwc1   %[in3],  6*4(%[win])                                    \t\n"
1107         "mul.s  %[s1],   %[s1],  %[c1]                                  \t\n"
1108         "mul.s  %[s3],   %[s3],  %[c2]                                  \t\n"
1109         "lwc1   %[in4],  4*6*4(%[buf])                                  \t\n"
1110         "lwc1   %[in5],  31*4(%[win])                                   \t\n"
1111         "lwc1   %[in6],  26*4(%[win])                                   \t\n"
1112         "add.s  %[t0],   %[s0],  %[s1]                                  \t\n"
1113         "sub.s  %[t1],   %[s0],  %[s1]                                  \t\n"
1114         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1115         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1116         "add.s  %[t0],   %[s2],  %[s3]                                  \t\n"
1117         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1118         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1119         "swc1   %[out3], 4*11*4(%[buf])                                 \t\n"
1120         "swc1   %[out4], 4*6*4(%[buf])                                  \t\n"
1121         "sub.s  %[t1],   %[s2],  %[s3]                                  \t\n"
1122         "swc1   %[out1], 352*4(%[out])                                  \t\n"
1123         "swc1   %[out2], 192*4(%[out])                                  \t\n"
1124         "lwc1   %[in1],  15*4(%[win])                                   \t\n"
1125         "lwc1   %[in2],  4*15*4(%[buf])                                 \t\n"
1126         "lwc1   %[in3],  2*4(%[win])                                    \t\n"
1127         "lwc1   %[in4],  4*2*4(%[buf])                                  \t\n"
1128         "lwc1   %[in5],  35*4(%[win])                                   \t\n"
1129         "lwc1   %[in6],  22*4(%[win])                                   \t\n"
1130         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1131         "lwc1   %[in1],  14*4(%[tmp])                                   \t\n"
1132         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1133         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1134         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1135         "swc1   %[out1], 480*4(%[out])                                  \t\n"
1136         "lwc1   %[in2],  12*4(%[tmp])                                   \t\n"
1137         "swc1   %[out2], 64*4(%[out])                                   \t\n"
1138         "swc1   %[out3], 4*15*4(%[buf])                                 \t\n"
1139         "swc1   %[out4], 4*2*4(%[buf])                                  \t\n"
1140         "lwc1   %[in3],  15*4(%[tmp])                                   \t\n"
1141         "add.s  %[s0],   %[in1], %[in2]                                 \t\n"
1142         "sub.s  %[s2],   %[in1], %[in2]                                 \t\n"
1143         "lwc1   %[in4],  13*4(%[tmp])                                   \t\n"
1144         "li.s   %[c1],   0.61038729438072803416                         \t\n"
1145         "li.s   %[c2],   0.87172339781054900991                         \t\n"
1146         "add.s  %[s1],   %[in3], %[in4]                                 \t\n"
1147         "sub.s  %[s3],   %[in3], %[in4]                                 \t\n"
1148         "lwc1   %[in1],  12*4(%[win])                                   \t\n"
1149         "lwc1   %[in2],  4*12*4(%[buf])                                 \t\n"
1150         "lwc1   %[in3],  5*4(%[win])                                    \t\n"
1151         "mul.s  %[s1],   %[s1],  %[c1]                                  \t\n"
1152         "mul.s  %[s3],   %[s3],  %[c2]                                  \t\n"
1153         "lwc1   %[in4],  4*5*4(%[buf])                                  \t\n"
1154         "lwc1   %[in5],  32*4(%[win])                                   \t\n"
1155         "lwc1   %[in6],  25*4(%[win])                                   \t\n"
1156         "add.s  %[t0],   %[s0],  %[s1]                                  \t\n"
1157         "sub.s  %[t1],   %[s0],  %[s1]                                  \t\n"
1158         "lwc1   %[s0],   16*4(%[tmp])                                   \t\n"
1159         "lwc1   %[s1],   17*4(%[tmp])                                   \t\n"
1160         "li.s   %[c1],   0.70710678118654752439                         \t\n"
1161         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1162         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1163         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1164         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1165         "add.s  %[t0],   %[s2],  %[s3]                                  \t\n"
1166         "swc1   %[out3], 4*12*4(%[buf])                                 \t\n"
1167         "swc1   %[out1], 384*4(%[out])                                  \t\n"
1168         "swc1   %[out2], 160*4(%[out])                                  \t\n"
1169         "swc1   %[out4], 4*5*4(%[buf])                                  \t\n"
1170         "sub.s  %[t1],   %[s2],  %[s3]                                  \t\n"
1171         "lwc1   %[in1],  14*4(%[win])                                   \t\n"
1172         "lwc1   %[in2],  4*14*4(%[buf])                                 \t\n"
1173         "lwc1   %[in3],  3*4(%[win])                                    \t\n"
1174         "lwc1   %[in4],  4*3*4(%[buf])                                  \t\n"
1175         "lwc1   %[in5],  34*4(%[win])                                   \t\n"
1176         "lwc1   %[in6],  23*4(%[win])                                   \t\n"
1177         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1178         "mul.s  %[s1],   %[s1],  %[c1]                                  \t\n"
1179         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1180         "mul.s  %[out3], %[in5], %[t0]                                  \t\n"
1181         "mul.s  %[out4], %[in6], %[t0]                                  \t\n"
1182         "swc1   %[out1], 448*4(%[out])                                  \t\n"
1183         "add.s  %[t0],   %[s0],  %[s1]                                  \t\n"
1184         "swc1   %[out2], 96*4(%[out])                                   \t\n"
1185         "swc1   %[out3], 4*14*4(%[buf])                                 \t\n"
1186         "swc1   %[out4], 4*3*4(%[buf])                                  \t\n"
1187         "sub.s  %[t1],   %[s0],  %[s1]                                  \t\n"
1188         "lwc1   %[in1],  13*4(%[win])                                   \t\n"
1189         "lwc1   %[in2],  4*13*4(%[buf])                                 \t\n"
1190         "lwc1   %[in3],  4*4(%[win])                                    \t\n"
1191         "lwc1   %[in4],  4*4*4(%[buf])                                  \t\n"
1192         "lwc1   %[in5],  33*4(%[win])                                   \t\n"
1193         "lwc1   %[in6],  24*4(%[win])                                   \t\n"
1194         "madd.s %[out1], %[in2], %[in1], %[t1]                          \t\n"
1195         "madd.s %[out2], %[in4], %[in3], %[t1]                          \t\n"
1196         "mul.s  %[out3], %[t0],  %[in5]                                 \t\n"
1197         "mul.s  %[out4], %[t0],  %[in6]                                 \t\n"
1198         "swc1   %[out1], 416*4(%[out])                                  \t\n"
1199         "swc1   %[out2], 128*4(%[out])                                  \t\n"
1200         "swc1   %[out3], 4*13*4(%[buf])                                 \t\n"
1201         "swc1   %[out4], 4*4*4(%[buf])                                  \t\n"
1202
1203         : [c1] "=&f" (c1), [c2] "=&f" (c2),
1204           [in1] "=&f" (in1), [in2] "=&f" (in2),
1205           [in3] "=&f" (in3), [in4] "=&f" (in4),
1206           [in5] "=&f" (in5), [in6] "=&f" (in6),
1207           [out1] "=&f" (out1), [out2] "=&f" (out2),
1208           [out3] "=&f" (out3), [out4] "=&f" (out4),
1209           [t0] "=&f" (t0), [t1] "=&f" (t1),
1210           [t2] "=&f" (t2), [t3] "=&f" (t3),
1211           [s0] "=&f" (s0), [s1] "=&f" (s1),
1212           [s2] "=&f" (s2), [s3] "=&f" (s3)
1213         : [tmp] "r" (tmp), [win] "r" (win),
1214           [buf] "r" (buf), [out] "r" (out)
1215     );
1216 }
1217
1218 static void ff_imdct36_blocks_mips_float(float *out, float *buf, float *in,
1219                                int count, int switch_point, int block_type)
1220 {
1221     int j;
1222     for (j=0 ; j < count; j++) {
1223         /* apply window & overlap with previous buffer */
1224
1225         /* select window */
1226         int win_idx = (switch_point && j < 2) ? 0 : block_type;
1227         float *win = ff_mdct_win_float[win_idx + (4 & -(j & 1))];
1228
1229         imdct36_mips_float(out, buf, in, win);
1230
1231         in  += 18;
1232         buf += ((j&3) != 3 ? 1 : (72-3));
1233         out++;
1234     }
1235 }
1236
1237 void ff_mpadsp_init_mipsfpu(MPADSPContext *s)
1238 {
1239     s->apply_window_float   = ff_mpadsp_apply_window_mips_float;
1240     s->imdct36_blocks_float = ff_imdct36_blocks_mips_float;
1241     s->dct32_float          = ff_dct32_mips_float;
1242 }