yading@11
|
1 /*
|
yading@11
|
2 * Copyright (c) 2012
|
yading@11
|
3 * MIPS Technologies, Inc., California.
|
yading@11
|
4 *
|
yading@11
|
5 * Redistribution and use in source and binary forms, with or without
|
yading@11
|
6 * modification, are permitted provided that the following conditions
|
yading@11
|
7 * are met:
|
yading@11
|
8 * 1. Redistributions of source code must retain the above copyright
|
yading@11
|
9 * notice, this list of conditions and the following disclaimer.
|
yading@11
|
10 * 2. Redistributions in binary form must reproduce the above copyright
|
yading@11
|
11 * notice, this list of conditions and the following disclaimer in the
|
yading@11
|
12 * documentation and/or other materials provided with the distribution.
|
yading@11
|
13 * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
|
yading@11
|
14 * contributors may be used to endorse or promote products derived from
|
yading@11
|
15 * this software without specific prior written permission.
|
yading@11
|
16 *
|
yading@11
|
17 * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
|
yading@11
|
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
yading@11
|
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
yading@11
|
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
|
yading@11
|
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
yading@11
|
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
yading@11
|
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
yading@11
|
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
yading@11
|
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
yading@11
|
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
yading@11
|
27 * SUCH DAMAGE.
|
yading@11
|
28 *
|
yading@11
|
29 * Author: Branimir Vasic (bvasic@mips.com)
|
yading@11
|
30 * Author: Zoran Lukic (zoranl@mips.com)
|
yading@11
|
31 *
|
yading@11
|
32 * This file is part of FFmpeg.
|
yading@11
|
33 *
|
yading@11
|
34 * FFmpeg is free software; you can redistribute it and/or
|
yading@11
|
35 * modify it under the terms of the GNU Lesser General Public
|
yading@11
|
36 * License as published by the Free Software Foundation; either
|
yading@11
|
37 * version 2.1 of the License, or (at your option) any later version.
|
yading@11
|
38 *
|
yading@11
|
39 * FFmpeg is distributed in the hope that it will be useful,
|
yading@11
|
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@11
|
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@11
|
42 * Lesser General Public License for more details.
|
yading@11
|
43 *
|
yading@11
|
44 * You should have received a copy of the GNU Lesser General Public
|
yading@11
|
45 * License along with FFmpeg; if not, write to the Free Software
|
yading@11
|
46 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@11
|
47 */
|
yading@11
|
48
|
yading@11
|
49 /**
|
yading@11
|
50 * @file
|
yading@11
|
51 * Reference: libavutil/float_dsp.c
|
yading@11
|
52 */
|
yading@11
|
53
|
yading@11
|
54 #include "config.h"
|
yading@11
|
55 #include "libavutil/float_dsp.h"
|
yading@11
|
56
|
yading@11
|
57 #if HAVE_INLINE_ASM && HAVE_MIPSFPU
|
yading@11
|
58 static void vector_fmul_mips(float *dst, const float *src0, const float *src1,
|
yading@11
|
59 int len)
|
yading@11
|
60 {
|
yading@11
|
61 int i;
|
yading@11
|
62
|
yading@11
|
63 if (len & 3) {
|
yading@11
|
64 for (i = 0; i < len; i++)
|
yading@11
|
65 dst[i] = src0[i] * src1[i];
|
yading@11
|
66 } else {
|
yading@11
|
67 float *d = (float *)dst;
|
yading@11
|
68 float *d_end = d + len;
|
yading@11
|
69 float *s0 = (float *)src0;
|
yading@11
|
70 float *s1 = (float *)src1;
|
yading@11
|
71
|
yading@11
|
72 float src0_0, src0_1, src0_2, src0_3;
|
yading@11
|
73 float src1_0, src1_1, src1_2, src1_3;
|
yading@11
|
74
|
yading@11
|
75 __asm__ volatile (
|
yading@11
|
76 "1: \n\t"
|
yading@11
|
77 "lwc1 %[src0_0], 0(%[s0]) \n\t"
|
yading@11
|
78 "lwc1 %[src1_0], 0(%[s1]) \n\t"
|
yading@11
|
79 "lwc1 %[src0_1], 4(%[s0]) \n\t"
|
yading@11
|
80 "lwc1 %[src1_1], 4(%[s1]) \n\t"
|
yading@11
|
81 "lwc1 %[src0_2], 8(%[s0]) \n\t"
|
yading@11
|
82 "lwc1 %[src1_2], 8(%[s1]) \n\t"
|
yading@11
|
83 "lwc1 %[src0_3], 12(%[s0]) \n\t"
|
yading@11
|
84 "lwc1 %[src1_3], 12(%[s1]) \n\t"
|
yading@11
|
85 "mul.s %[src0_0], %[src0_0], %[src1_0] \n\t"
|
yading@11
|
86 "mul.s %[src0_1], %[src0_1], %[src1_1] \n\t"
|
yading@11
|
87 "mul.s %[src0_2], %[src0_2], %[src1_2] \n\t"
|
yading@11
|
88 "mul.s %[src0_3], %[src0_3], %[src1_3] \n\t"
|
yading@11
|
89 "swc1 %[src0_0], 0(%[d]) \n\t"
|
yading@11
|
90 "swc1 %[src0_1], 4(%[d]) \n\t"
|
yading@11
|
91 "swc1 %[src0_2], 8(%[d]) \n\t"
|
yading@11
|
92 "swc1 %[src0_3], 12(%[d]) \n\t"
|
yading@11
|
93 "addiu %[s0], %[s0], 16 \n\t"
|
yading@11
|
94 "addiu %[s1], %[s1], 16 \n\t"
|
yading@11
|
95 "addiu %[d], %[d], 16 \n\t"
|
yading@11
|
96 "bne %[d], %[d_end], 1b \n\t"
|
yading@11
|
97
|
yading@11
|
98 : [src0_0]"=&f"(src0_0), [src0_1]"=&f"(src0_1),
|
yading@11
|
99 [src0_2]"=&f"(src0_2), [src0_3]"=&f"(src0_3),
|
yading@11
|
100 [src1_0]"=&f"(src1_0), [src1_1]"=&f"(src1_1),
|
yading@11
|
101 [src1_2]"=&f"(src1_2), [src1_3]"=&f"(src1_3),
|
yading@11
|
102 [d]"+r"(d), [s0]"+r"(s0), [s1]"+r"(s1)
|
yading@11
|
103 : [d_end]"r"(d_end)
|
yading@11
|
104 : "memory"
|
yading@11
|
105 );
|
yading@11
|
106 }
|
yading@11
|
107 }
|
yading@11
|
108
|
yading@11
|
109 static void vector_fmul_scalar_mips(float *dst, const float *src, float mul,
|
yading@11
|
110 int len)
|
yading@11
|
111 {
|
yading@11
|
112 float temp0, temp1, temp2, temp3;
|
yading@11
|
113 float *local_src = (float*)src;
|
yading@11
|
114 float *end = local_src + len;
|
yading@11
|
115
|
yading@11
|
116 /* loop unrolled 4 times */
|
yading@11
|
117 __asm__ volatile(
|
yading@11
|
118 ".set push \n\t"
|
yading@11
|
119 ".set noreorder \n\t"
|
yading@11
|
120 "1: \n\t"
|
yading@11
|
121 "lwc1 %[temp0], 0(%[src]) \n\t"
|
yading@11
|
122 "lwc1 %[temp1], 4(%[src]) \n\t"
|
yading@11
|
123 "lwc1 %[temp2], 8(%[src]) \n\t"
|
yading@11
|
124 "lwc1 %[temp3], 12(%[src]) \n\t"
|
yading@11
|
125 "addiu %[dst], %[dst], 16 \n\t"
|
yading@11
|
126 "mul.s %[temp0], %[temp0], %[mul] \n\t"
|
yading@11
|
127 "mul.s %[temp1], %[temp1], %[mul] \n\t"
|
yading@11
|
128 "mul.s %[temp2], %[temp2], %[mul] \n\t"
|
yading@11
|
129 "mul.s %[temp3], %[temp3], %[mul] \n\t"
|
yading@11
|
130 "addiu %[src], %[src], 16 \n\t"
|
yading@11
|
131 "swc1 %[temp0], -16(%[dst]) \n\t"
|
yading@11
|
132 "swc1 %[temp1], -12(%[dst]) \n\t"
|
yading@11
|
133 "swc1 %[temp2], -8(%[dst]) \n\t"
|
yading@11
|
134 "bne %[src], %[end], 1b \n\t"
|
yading@11
|
135 " swc1 %[temp3], -4(%[dst]) \n\t"
|
yading@11
|
136 ".set pop \n\t"
|
yading@11
|
137
|
yading@11
|
138 : [temp0]"=&f"(temp0), [temp1]"=&f"(temp1),
|
yading@11
|
139 [temp2]"=&f"(temp2), [temp3]"=&f"(temp3),
|
yading@11
|
140 [dst]"+r"(dst), [src]"+r"(local_src)
|
yading@11
|
141 : [end]"r"(end), [mul]"f"(mul)
|
yading@11
|
142 : "memory"
|
yading@11
|
143 );
|
yading@11
|
144 }
|
yading@11
|
145
|
yading@11
|
146 static void vector_fmul_window_mips(float *dst, const float *src0,
|
yading@11
|
147 const float *src1, const float *win, int len)
|
yading@11
|
148 {
|
yading@11
|
149 int i, j;
|
yading@11
|
150 /*
|
yading@11
|
151 * variables used in inline assembler
|
yading@11
|
152 */
|
yading@11
|
153 float * dst_i, * dst_j, * dst_i2, * dst_j2;
|
yading@11
|
154 float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
yading@11
|
155
|
yading@11
|
156 dst += len;
|
yading@11
|
157 win += len;
|
yading@11
|
158 src0 += len;
|
yading@11
|
159
|
yading@11
|
160 for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) {
|
yading@11
|
161
|
yading@11
|
162 dst_i = dst + i;
|
yading@11
|
163 dst_j = dst + j;
|
yading@11
|
164
|
yading@11
|
165 dst_i2 = dst + i + 4;
|
yading@11
|
166 dst_j2 = dst + j - 4;
|
yading@11
|
167
|
yading@11
|
168 __asm__ volatile (
|
yading@11
|
169 "mul.s %[temp], %[s1], %[wi] \n\t"
|
yading@11
|
170 "mul.s %[temp1], %[s1], %[wj] \n\t"
|
yading@11
|
171 "mul.s %[temp2], %[s11], %[wi1] \n\t"
|
yading@11
|
172 "mul.s %[temp3], %[s11], %[wj1] \n\t"
|
yading@11
|
173
|
yading@11
|
174 "msub.s %[temp], %[temp], %[s0], %[wj] \n\t"
|
yading@11
|
175 "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t"
|
yading@11
|
176 "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t"
|
yading@11
|
177 "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t"
|
yading@11
|
178
|
yading@11
|
179 "swc1 %[temp], 0(%[dst_i]) \n\t" /* dst[i] = s0*wj - s1*wi; */
|
yading@11
|
180 "swc1 %[temp1], 0(%[dst_j]) \n\t" /* dst[j] = s0*wi + s1*wj; */
|
yading@11
|
181 "swc1 %[temp2], 4(%[dst_i]) \n\t" /* dst[i+1] = s01*wj1 - s11*wi1; */
|
yading@11
|
182 "swc1 %[temp3], -4(%[dst_j]) \n\t" /* dst[j-1] = s01*wi1 + s11*wj1; */
|
yading@11
|
183
|
yading@11
|
184 "mul.s %[temp4], %[s12], %[wi2] \n\t"
|
yading@11
|
185 "mul.s %[temp5], %[s12], %[wj2] \n\t"
|
yading@11
|
186 "mul.s %[temp6], %[s13], %[wi3] \n\t"
|
yading@11
|
187 "mul.s %[temp7], %[s13], %[wj3] \n\t"
|
yading@11
|
188
|
yading@11
|
189 "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t"
|
yading@11
|
190 "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t"
|
yading@11
|
191 "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t"
|
yading@11
|
192 "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t"
|
yading@11
|
193
|
yading@11
|
194 "swc1 %[temp4], 8(%[dst_i]) \n\t" /* dst[i+2] = s02*wj2 - s12*wi2; */
|
yading@11
|
195 "swc1 %[temp5], -8(%[dst_j]) \n\t" /* dst[j-2] = s02*wi2 + s12*wj2; */
|
yading@11
|
196 "swc1 %[temp6], 12(%[dst_i]) \n\t" /* dst[i+2] = s03*wj3 - s13*wi3; */
|
yading@11
|
197 "swc1 %[temp7], -12(%[dst_j]) \n\t" /* dst[j-3] = s03*wi3 + s13*wj3; */
|
yading@11
|
198 : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
|
yading@11
|
199 [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
|
yading@11
|
200 [temp6]"=&f"(temp6), [temp7]"=&f"(temp7)
|
yading@11
|
201 : [dst_j]"r"(dst_j), [dst_i]"r" (dst_i),
|
yading@11
|
202 [s0] "f"(src0[i]), [wj] "f"(win[j]), [s1] "f"(src1[j]),
|
yading@11
|
203 [wi] "f"(win[i]), [s01]"f"(src0[i + 1]),[wj1]"f"(win[j - 1]),
|
yading@11
|
204 [s11]"f"(src1[j - 1]), [wi1]"f"(win[i + 1]), [s02]"f"(src0[i + 2]),
|
yading@11
|
205 [wj2]"f"(win[j - 2]), [s12]"f"(src1[j - 2]),[wi2]"f"(win[i + 2]),
|
yading@11
|
206 [s03]"f"(src0[i + 3]), [wj3]"f"(win[j - 3]), [s13]"f"(src1[j - 3]),
|
yading@11
|
207 [wi3]"f"(win[i + 3])
|
yading@11
|
208 : "memory"
|
yading@11
|
209 );
|
yading@11
|
210
|
yading@11
|
211 __asm__ volatile (
|
yading@11
|
212 "mul.s %[temp], %[s1], %[wi] \n\t"
|
yading@11
|
213 "mul.s %[temp1], %[s1], %[wj] \n\t"
|
yading@11
|
214 "mul.s %[temp2], %[s11], %[wi1] \n\t"
|
yading@11
|
215 "mul.s %[temp3], %[s11], %[wj1] \n\t"
|
yading@11
|
216
|
yading@11
|
217 "msub.s %[temp], %[temp], %[s0], %[wj] \n\t"
|
yading@11
|
218 "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t"
|
yading@11
|
219 "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t"
|
yading@11
|
220 "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t"
|
yading@11
|
221
|
yading@11
|
222 "swc1 %[temp], 0(%[dst_i2]) \n\t" /* dst[i] = s0*wj - s1*wi; */
|
yading@11
|
223 "swc1 %[temp1], 0(%[dst_j2]) \n\t" /* dst[j] = s0*wi + s1*wj; */
|
yading@11
|
224 "swc1 %[temp2], 4(%[dst_i2]) \n\t" /* dst[i+1] = s01*wj1 - s11*wi1; */
|
yading@11
|
225 "swc1 %[temp3], -4(%[dst_j2]) \n\t" /* dst[j-1] = s01*wi1 + s11*wj1; */
|
yading@11
|
226
|
yading@11
|
227 "mul.s %[temp4], %[s12], %[wi2] \n\t"
|
yading@11
|
228 "mul.s %[temp5], %[s12], %[wj2] \n\t"
|
yading@11
|
229 "mul.s %[temp6], %[s13], %[wi3] \n\t"
|
yading@11
|
230 "mul.s %[temp7], %[s13], %[wj3] \n\t"
|
yading@11
|
231
|
yading@11
|
232 "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t"
|
yading@11
|
233 "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t"
|
yading@11
|
234 "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t"
|
yading@11
|
235 "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t"
|
yading@11
|
236
|
yading@11
|
237 "swc1 %[temp4], 8(%[dst_i2]) \n\t" /* dst[i+2] = s02*wj2 - s12*wi2; */
|
yading@11
|
238 "swc1 %[temp5], -8(%[dst_j2]) \n\t" /* dst[j-2] = s02*wi2 + s12*wj2; */
|
yading@11
|
239 "swc1 %[temp6], 12(%[dst_i2]) \n\t" /* dst[i+2] = s03*wj3 - s13*wi3; */
|
yading@11
|
240 "swc1 %[temp7], -12(%[dst_j2]) \n\t" /* dst[j-3] = s03*wi3 + s13*wj3; */
|
yading@11
|
241 : [temp]"=&f"(temp),
|
yading@11
|
242 [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3),
|
yading@11
|
243 [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6),
|
yading@11
|
244 [temp7] "=&f" (temp7)
|
yading@11
|
245 : [dst_j2]"r"(dst_j2), [dst_i2]"r"(dst_i2),
|
yading@11
|
246 [s0] "f"(src0[i + 4]), [wj] "f"(win[j - 4]), [s1] "f"(src1[j - 4]),
|
yading@11
|
247 [wi] "f"(win[i + 4]), [s01]"f"(src0[i + 5]),[wj1]"f"(win[j - 5]),
|
yading@11
|
248 [s11]"f"(src1[j - 5]), [wi1]"f"(win[i + 5]), [s02]"f"(src0[i + 6]),
|
yading@11
|
249 [wj2]"f"(win[j - 6]), [s12]"f"(src1[j - 6]),[wi2]"f"(win[i + 6]),
|
yading@11
|
250 [s03]"f"(src0[i + 7]), [wj3]"f"(win[j - 7]), [s13]"f"(src1[j - 7]),
|
yading@11
|
251 [wi3]"f"(win[i + 7])
|
yading@11
|
252 : "memory"
|
yading@11
|
253 );
|
yading@11
|
254 }
|
yading@11
|
255 }
|
yading@11
|
256
|
yading@11
|
257 static void butterflies_float_mips(float *av_restrict v1, float *av_restrict v2,
|
yading@11
|
258 int len)
|
yading@11
|
259 {
|
yading@11
|
260 float temp0, temp1, temp2, temp3, temp4;
|
yading@11
|
261 float temp5, temp6, temp7, temp8, temp9;
|
yading@11
|
262 float temp10, temp11, temp12, temp13, temp14, temp15;
|
yading@11
|
263 int pom;
|
yading@11
|
264 pom = (len >> 2)-1;
|
yading@11
|
265
|
yading@11
|
266 /* loop unrolled 4 times */
|
yading@11
|
267 __asm__ volatile (
|
yading@11
|
268 "lwc1 %[temp0], 0(%[v1]) \n\t"
|
yading@11
|
269 "lwc1 %[temp1], 4(%[v1]) \n\t"
|
yading@11
|
270 "lwc1 %[temp2], 8(%[v1]) \n\t"
|
yading@11
|
271 "lwc1 %[temp3], 12(%[v1]) \n\t"
|
yading@11
|
272 "lwc1 %[temp4], 0(%[v2]) \n\t"
|
yading@11
|
273 "lwc1 %[temp5], 4(%[v2]) \n\t"
|
yading@11
|
274 "lwc1 %[temp6], 8(%[v2]) \n\t"
|
yading@11
|
275 "lwc1 %[temp7], 12(%[v2]) \n\t"
|
yading@11
|
276 "beq %[pom], $zero, 2f \n\t"
|
yading@11
|
277 "1: \n\t"
|
yading@11
|
278 "sub.s %[temp8], %[temp0], %[temp4] \n\t"
|
yading@11
|
279 "add.s %[temp9], %[temp0], %[temp4] \n\t"
|
yading@11
|
280 "sub.s %[temp10], %[temp1], %[temp5] \n\t"
|
yading@11
|
281 "add.s %[temp11], %[temp1], %[temp5] \n\t"
|
yading@11
|
282 "sub.s %[temp12], %[temp2], %[temp6] \n\t"
|
yading@11
|
283 "add.s %[temp13], %[temp2], %[temp6] \n\t"
|
yading@11
|
284 "sub.s %[temp14], %[temp3], %[temp7] \n\t"
|
yading@11
|
285 "add.s %[temp15], %[temp3], %[temp7] \n\t"
|
yading@11
|
286 "addiu %[v1], %[v1], 16 \n\t"
|
yading@11
|
287 "addiu %[v2], %[v2], 16 \n\t"
|
yading@11
|
288 "addiu %[pom], %[pom], -1 \n\t"
|
yading@11
|
289 "lwc1 %[temp0], 0(%[v1]) \n\t"
|
yading@11
|
290 "lwc1 %[temp1], 4(%[v1]) \n\t"
|
yading@11
|
291 "lwc1 %[temp2], 8(%[v1]) \n\t"
|
yading@11
|
292 "lwc1 %[temp3], 12(%[v1]) \n\t"
|
yading@11
|
293 "lwc1 %[temp4], 0(%[v2]) \n\t"
|
yading@11
|
294 "lwc1 %[temp5], 4(%[v2]) \n\t"
|
yading@11
|
295 "lwc1 %[temp6], 8(%[v2]) \n\t"
|
yading@11
|
296 "lwc1 %[temp7], 12(%[v2]) \n\t"
|
yading@11
|
297 "swc1 %[temp9], -16(%[v1]) \n\t"
|
yading@11
|
298 "swc1 %[temp8], -16(%[v2]) \n\t"
|
yading@11
|
299 "swc1 %[temp11], -12(%[v1]) \n\t"
|
yading@11
|
300 "swc1 %[temp10], -12(%[v2]) \n\t"
|
yading@11
|
301 "swc1 %[temp13], -8(%[v1]) \n\t"
|
yading@11
|
302 "swc1 %[temp12], -8(%[v2]) \n\t"
|
yading@11
|
303 "swc1 %[temp15], -4(%[v1]) \n\t"
|
yading@11
|
304 "swc1 %[temp14], -4(%[v2]) \n\t"
|
yading@11
|
305 "bgtz %[pom], 1b \n\t"
|
yading@11
|
306 "2: \n\t"
|
yading@11
|
307 "sub.s %[temp8], %[temp0], %[temp4] \n\t"
|
yading@11
|
308 "add.s %[temp9], %[temp0], %[temp4] \n\t"
|
yading@11
|
309 "sub.s %[temp10], %[temp1], %[temp5] \n\t"
|
yading@11
|
310 "add.s %[temp11], %[temp1], %[temp5] \n\t"
|
yading@11
|
311 "sub.s %[temp12], %[temp2], %[temp6] \n\t"
|
yading@11
|
312 "add.s %[temp13], %[temp2], %[temp6] \n\t"
|
yading@11
|
313 "sub.s %[temp14], %[temp3], %[temp7] \n\t"
|
yading@11
|
314 "add.s %[temp15], %[temp3], %[temp7] \n\t"
|
yading@11
|
315 "swc1 %[temp9], 0(%[v1]) \n\t"
|
yading@11
|
316 "swc1 %[temp8], 0(%[v2]) \n\t"
|
yading@11
|
317 "swc1 %[temp11], 4(%[v1]) \n\t"
|
yading@11
|
318 "swc1 %[temp10], 4(%[v2]) \n\t"
|
yading@11
|
319 "swc1 %[temp13], 8(%[v1]) \n\t"
|
yading@11
|
320 "swc1 %[temp12], 8(%[v2]) \n\t"
|
yading@11
|
321 "swc1 %[temp15], 12(%[v1]) \n\t"
|
yading@11
|
322 "swc1 %[temp14], 12(%[v2]) \n\t"
|
yading@11
|
323
|
yading@11
|
324 : [v1]"+r"(v1), [v2]"+r"(v2), [pom]"+r"(pom), [temp0] "=&f" (temp0),
|
yading@11
|
325 [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3),
|
yading@11
|
326 [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6),
|
yading@11
|
327 [temp7]"=&f"(temp7), [temp8]"=&f"(temp8), [temp9]"=&f"(temp9),
|
yading@11
|
328 [temp10]"=&f"(temp10), [temp11]"=&f"(temp11), [temp12]"=&f"(temp12),
|
yading@11
|
329 [temp13]"=&f"(temp13), [temp14]"=&f"(temp14), [temp15]"=&f"(temp15)
|
yading@11
|
330 :
|
yading@11
|
331 : "memory"
|
yading@11
|
332 );
|
yading@11
|
333 }
|
yading@11
|
334
|
yading@11
|
335 static void vector_fmul_reverse_mips(float *dst, const float *src0, const float *src1, int len){
|
yading@11
|
336 int i;
|
yading@11
|
337 float temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
yading@11
|
338 src1 += len-1;
|
yading@11
|
339
|
yading@11
|
340 for(i=0; i<(len>>2); i++)
|
yading@11
|
341 {
|
yading@11
|
342 /* loop unrolled 4 times */
|
yading@11
|
343 __asm__ volatile(
|
yading@11
|
344 "lwc1 %[temp0], 0(%[src0]) \n\t"
|
yading@11
|
345 "lwc1 %[temp1], 0(%[src1]) \n\t"
|
yading@11
|
346 "lwc1 %[temp2], 4(%[src0]) \n\t"
|
yading@11
|
347 "lwc1 %[temp3], -4(%[src1]) \n\t"
|
yading@11
|
348 "lwc1 %[temp4], 8(%[src0]) \n\t"
|
yading@11
|
349 "lwc1 %[temp5], -8(%[src1]) \n\t"
|
yading@11
|
350 "lwc1 %[temp6], 12(%[src0]) \n\t"
|
yading@11
|
351 "lwc1 %[temp7], -12(%[src1]) \n\t"
|
yading@11
|
352 "mul.s %[temp0], %[temp1], %[temp0] \n\t"
|
yading@11
|
353 "mul.s %[temp2], %[temp3], %[temp2] \n\t"
|
yading@11
|
354 "mul.s %[temp4], %[temp5], %[temp4] \n\t"
|
yading@11
|
355 "mul.s %[temp6], %[temp7], %[temp6] \n\t"
|
yading@11
|
356 "addiu %[src0], %[src0], 16 \n\t"
|
yading@11
|
357 "addiu %[src1], %[src1], -16 \n\t"
|
yading@11
|
358 "addiu %[dst], %[dst], 16 \n\t"
|
yading@11
|
359 "swc1 %[temp0], -16(%[dst]) \n\t"
|
yading@11
|
360 "swc1 %[temp2], -12(%[dst]) \n\t"
|
yading@11
|
361 "swc1 %[temp4], -8(%[dst]) \n\t"
|
yading@11
|
362 "swc1 %[temp6], -4(%[dst]) \n\t"
|
yading@11
|
363
|
yading@11
|
364 : [dst]"+r"(dst), [src0]"+r"(src0), [src1]"+r"(src1),
|
yading@11
|
365 [temp0]"=&f"(temp0), [temp1]"=&f"(temp1),[temp2]"=&f"(temp2),
|
yading@11
|
366 [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
|
yading@11
|
367 [temp6]"=&f"(temp6), [temp7]"=&f"(temp7)
|
yading@11
|
368 :
|
yading@11
|
369 : "memory"
|
yading@11
|
370 );
|
yading@11
|
371 }
|
yading@11
|
372 }
|
yading@11
|
373 #endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
|
yading@11
|
374
|
yading@11
|
375 void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp) {
|
yading@11
|
376 #if HAVE_INLINE_ASM && HAVE_MIPSFPU
|
yading@11
|
377 fdsp->vector_fmul = vector_fmul_mips;
|
yading@11
|
378 fdsp->vector_fmul_scalar = vector_fmul_scalar_mips;
|
yading@11
|
379 fdsp->vector_fmul_window = vector_fmul_window_mips;
|
yading@11
|
380 fdsp->butterflies_float = butterflies_float_mips;
|
yading@11
|
381 fdsp->vector_fmul_reverse = vector_fmul_reverse_mips;
|
yading@11
|
382 #endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
|
yading@11
|
383 }
|