Go to the documentation of this file.
24 #ifndef AVUTIL_MIPS_MMIUTILS_H
25 #define AVUTIL_MIPS_MMIUTILS_H
37 #define DECLARE_VAR_LOW32
38 #define RESTRICT_ASM_LOW32
39 #define DECLARE_VAR_ALL64
40 #define RESTRICT_ASM_ALL64
41 #define DECLARE_VAR_ADDRT
42 #define RESTRICT_ASM_ADDRT
46 #define MMI_LWX(reg, addr, stride, bias) \
48 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
49 "lw "#reg", "#bias"($at) \n\t" \
52 #define MMI_SWX(reg, addr, stride, bias) \
54 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
55 "sw "#reg", "#bias"($at) \n\t" \
58 #define MMI_LDX(reg, addr, stride, bias) \
60 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
61 "ld "#reg", "#bias"($at) \n\t" \
64 #define MMI_SDX(reg, addr, stride, bias) \
66 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
67 "sd "#reg", "#bias"($at) \n\t" \
70 #define MMI_LWC1(fp, addr, bias) \
71 "lwc1 "#fp", "#bias"("#addr") \n\t"
73 #define MMI_ULWC1(fp, addr, bias) \
75 "ulw $at, "#bias"("#addr") \n\t" \
76 "mtc1 $at, "#fp" \n\t" \
79 #define MMI_LWXC1(fp, addr, stride, bias) \
81 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
82 MMI_LWC1(fp, $at, bias) \
85 #define MMI_SWC1(fp, addr, bias) \
86 "swc1 "#fp", "#bias"("#addr") \n\t"
88 #define MMI_USWC1(fp, addr, bias) \
90 "mfc1 $at, "#fp" \n\t" \
91 "usw $at, "#bias"("#addr") \n\t" \
94 #define MMI_SWXC1(fp, addr, stride, bias) \
96 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
97 MMI_SWC1(fp, $at, bias) \
100 #define MMI_LDC1(fp, addr, bias) \
101 "ldc1 "#fp", "#bias"("#addr") \n\t"
103 #define MMI_ULDC1(fp, addr, bias) \
105 "uld $at, "#bias"("#addr") \n\t" \
106 "dmtc1 $at, "#fp" \n\t" \
109 #define MMI_LDXC1(fp, addr, stride, bias) \
111 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
112 MMI_LDC1(fp, $at, bias) \
115 #define MMI_SDC1(fp, addr, bias) \
116 "sdc1 "#fp", "#bias"("#addr") \n\t"
118 #define MMI_USDC1(fp, addr, bias) \
120 "dmfc1 $at, "#fp" \n\t" \
121 "usd $at, "#bias"("#addr") \n\t" \
124 #define MMI_SDXC1(fp, addr, stride, bias) \
126 PTR_ADDU "$at, "#addr", "#stride" \n\t" \
127 MMI_SDC1(fp, $at, bias) \
130 #define MMI_LQ(reg1, reg2, addr, bias) \
131 "ld "#reg1", "#bias"("#addr") \n\t" \
132 "ld "#reg2", 8+"#bias"("#addr") \n\t"
134 #define MMI_SQ(reg1, reg2, addr, bias) \
135 "sd "#reg1", "#bias"("#addr") \n\t" \
136 "sd "#reg2", 8+"#bias"("#addr") \n\t"
138 #define MMI_LQC1(fp1, fp2, addr, bias) \
139 "ldc1 "#fp1", "#bias"("#addr") \n\t" \
140 "ldc1 "#fp2", 8+"#bias"("#addr") \n\t"
142 #define MMI_SQC1(fp1, fp2, addr, bias) \
143 "sdc1 "#fp1", "#bias"("#addr") \n\t" \
144 "sdc1 "#fp2", 8+"#bias"("#addr") \n\t"
148 #define MMI_LWX(reg, addr, stride, bias) \
149 "gslwx "#reg", "#bias"("#addr", "#stride") \n\t"
151 #define MMI_SWX(reg, addr, stride, bias) \
152 "gsswx "#reg", "#bias"("#addr", "#stride") \n\t"
154 #define MMI_LDX(reg, addr, stride, bias) \
155 "gsldx "#reg", "#bias"("#addr", "#stride") \n\t"
157 #define MMI_SDX(reg, addr, stride, bias) \
158 "gssdx "#reg", "#bias"("#addr", "#stride") \n\t"
160 #define MMI_LWC1(fp, addr, bias) \
161 "lwc1 "#fp", "#bias"("#addr") \n\t"
163 #if _MIPS_SIM == _ABIO32
165 #define MMI_LWLRC1(fp, addr, bias, off) \
167 "lwl $at, "#bias"+"#off"("#addr") \n\t" \
168 "lwr $at, "#bias"("#addr") \n\t" \
169 "mtc1 $at, "#fp" \n\t" \
174 #define DECLARE_VAR_LOW32
175 #define RESTRICT_ASM_LOW32
177 #define MMI_ULWC1(fp, addr, bias) \
178 "gslwlc1 "#fp", 3+"#bias"("#addr") \n\t" \
179 "gslwrc1 "#fp", "#bias"("#addr") \n\t"
183 #define MMI_LWXC1(fp, addr, stride, bias) \
184 "gslwxc1 "#fp", "#bias"("#addr", "#stride") \n\t"
186 #define MMI_SWC1(fp, addr, bias) \
187 "swc1 "#fp", "#bias"("#addr") \n\t"
189 #define MMI_USWC1(fp, addr, bias) \
190 "gsswlc1 "#fp", 3+"#bias"("#addr") \n\t" \
191 "gsswrc1 "#fp", "#bias"("#addr") \n\t"
193 #define MMI_SWXC1(fp, addr, stride, bias) \
194 "gsswxc1 "#fp", "#bias"("#addr", "#stride") \n\t"
196 #define MMI_LDC1(fp, addr, bias) \
197 "ldc1 "#fp", "#bias"("#addr") \n\t"
199 #define MMI_ULDC1(fp, addr, bias) \
200 "gsldlc1 "#fp", 7+"#bias"("#addr") \n\t" \
201 "gsldrc1 "#fp", "#bias"("#addr") \n\t"
203 #define MMI_LDXC1(fp, addr, stride, bias) \
204 "gsldxc1 "#fp", "#bias"("#addr", "#stride") \n\t"
206 #define MMI_SDC1(fp, addr, bias) \
207 "sdc1 "#fp", "#bias"("#addr") \n\t"
209 #define MMI_USDC1(fp, addr, bias) \
210 "gssdlc1 "#fp", 7+"#bias"("#addr") \n\t" \
211 "gssdrc1 "#fp", "#bias"("#addr") \n\t"
213 #define MMI_SDXC1(fp, addr, stride, bias) \
214 "gssdxc1 "#fp", "#bias"("#addr", "#stride") \n\t"
216 #define MMI_LQ(reg1, reg2, addr, bias) \
217 "gslq "#reg1", "#reg2", "#bias"("#addr") \n\t"
219 #define MMI_SQ(reg1, reg2, addr, bias) \
220 "gssq "#reg1", "#reg2", "#bias"("#addr") \n\t"
222 #define MMI_LQC1(fp1, fp2, addr, bias) \
223 "gslqc1 "#fp1", "#fp2", "#bias"("#addr") \n\t"
225 #define MMI_SQC1(fp1, fp2, addr, bias) \
226 "gssqc1 "#fp1", "#fp2", "#bias"("#addr") \n\t"
236 LOCAL_ALIGNED_16(double, temp_backup_reg, [8]); \
237 if (_MIPS_SIM == _ABI64) \
239 MMI_SQC1($f25, $f24, %[temp], 0x00) \
240 MMI_SQC1($f27, $f26, %[temp], 0x10) \
241 MMI_SQC1($f29, $f28, %[temp], 0x20) \
242 MMI_SQC1($f31, $f30, %[temp], 0x30) \
244 : [temp]"r"(temp_backup_reg) \
249 MMI_SQC1($f22, $f20, %[temp], 0x10) \
250 MMI_SQC1($f26, $f24, %[temp], 0x10) \
251 MMI_SQC1($f30, $f28, %[temp], 0x20) \
253 : [temp]"r"(temp_backup_reg) \
260 #define RECOVER_REG \
261 if (_MIPS_SIM == _ABI64) \
263 MMI_LQC1($f25, $f24, %[temp], 0x00) \
264 MMI_LQC1($f27, $f26, %[temp], 0x10) \
265 MMI_LQC1($f29, $f28, %[temp], 0x20) \
266 MMI_LQC1($f31, $f30, %[temp], 0x30) \
268 : [temp]"r"(temp_backup_reg) \
273 MMI_LQC1($f22, $f20, %[temp], 0x10) \
274 MMI_LQC1($f26, $f24, %[temp], 0x10) \
275 MMI_LQC1($f30, $f28, %[temp], 0x20) \
277 : [temp]"r"(temp_backup_reg) \
286 #define TRANSPOSE_2W(fr_i0, fr_i1, fr_o0, fr_o1) \
287 "punpcklwd "#fr_o0", "#fr_i0", "#fr_i1" \n\t" \
288 "punpckhwd "#fr_o1", "#fr_i0", "#fr_i1" \n\t"
295 #define TRANSPOSE_4H(fr_i0, fr_i1, fr_i2, fr_i3, \
296 fr_t0, fr_t1, fr_t2, fr_t3) \
297 "punpcklhw "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
298 "punpckhhw "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
299 "punpcklhw "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
300 "punpckhhw "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
301 "punpcklwd "#fr_i0", "#fr_t0", "#fr_t2" \n\t" \
302 "punpckhwd "#fr_i1", "#fr_t0", "#fr_t2" \n\t" \
303 "punpcklwd "#fr_i2", "#fr_t1", "#fr_t3" \n\t" \
304 "punpckhwd "#fr_i3", "#fr_t1", "#fr_t3" \n\t"
311 #define TRANSPOSE_8B(fr_i0, fr_i1, fr_i2, fr_i3, fr_i4, fr_i5, \
312 fr_i6, fr_i7, fr_t0, fr_t1, fr_t2, fr_t3) \
313 "punpcklbh "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
314 "punpckhbh "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
315 "punpcklbh "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
316 "punpckhbh "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
317 "punpcklbh "#fr_i0", "#fr_i4", "#fr_i5" \n\t" \
318 "punpckhbh "#fr_i1", "#fr_i4", "#fr_i5" \n\t" \
319 "punpcklbh "#fr_i2", "#fr_i6", "#fr_i7" \n\t" \
320 "punpckhbh "#fr_i3", "#fr_i6", "#fr_i7" \n\t" \
321 "punpcklhw "#fr_i4", "#fr_t0", "#fr_t2" \n\t" \
322 "punpckhhw "#fr_i5", "#fr_t0", "#fr_t2" \n\t" \
323 "punpcklhw "#fr_i6", "#fr_t1", "#fr_t3" \n\t" \
324 "punpckhhw "#fr_i7", "#fr_t1", "#fr_t3" \n\t" \
325 "punpcklhw "#fr_t0", "#fr_i0", "#fr_i2" \n\t" \
326 "punpckhhw "#fr_t1", "#fr_i0", "#fr_i2" \n\t" \
327 "punpcklhw "#fr_t2", "#fr_i1", "#fr_i3" \n\t" \
328 "punpckhhw "#fr_t3", "#fr_i1", "#fr_i3" \n\t" \
329 "punpcklwd "#fr_i0", "#fr_i4", "#fr_t0" \n\t" \
330 "punpckhwd "#fr_i1", "#fr_i4", "#fr_t0" \n\t" \
331 "punpcklwd "#fr_i2", "#fr_i5", "#fr_t1" \n\t" \
332 "punpckhwd "#fr_i3", "#fr_i5", "#fr_t1" \n\t" \
333 "punpcklwd "#fr_i4", "#fr_i6", "#fr_t2" \n\t" \
334 "punpckhwd "#fr_i5", "#fr_i6", "#fr_t2" \n\t" \
335 "punpcklwd "#fr_i6", "#fr_i7", "#fr_t3" \n\t" \
336 "punpckhwd "#fr_i7", "#fr_i7", "#fr_t3" \n\t"
345 #define PSRAB_MMI(fr_i0, fr_i1, fr_t0, fr_t1, fr_d0) \
346 "punpcklbh "#fr_t0", "#fr_t0", "#fr_i0" \n\t" \
347 "punpckhbh "#fr_t1", "#fr_t1", "#fr_i0" \n\t" \
348 "psrah "#fr_t0", "#fr_t0", "#fr_i1" \n\t" \
349 "psrah "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \
350 "packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"
359 #define PSRLB_MMI(fr_i0, fr_i1, fr_t0, fr_t1, fr_d0) \
360 "punpcklbh "#fr_t0", "#fr_t0", "#fr_i0" \n\t" \
361 "punpckhbh "#fr_t1", "#fr_t1", "#fr_i0" \n\t" \
362 "psrlh "#fr_t0", "#fr_t0", "#fr_i1" \n\t" \
363 "psrlh "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \
364 "packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"
366 #define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
367 "psrah "#fp1", "#fp1", "#shift" \n\t" \
368 "psrah "#fp2", "#fp2", "#shift" \n\t" \
369 "psrah "#fp3", "#fp3", "#shift" \n\t" \
370 "psrah "#fp4", "#fp4", "#shift" \n\t"
372 #define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
373 PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
374 PSRAH_4_MMI(fp5, fp6, fp7, fp8, shift)
383 #define ROUND_POWER_OF_TWO_MMI(fr_i0, fr_i1, fr_t0, fr_t1, gr_t0) \
384 "li "#gr_t0", 0x01 \n\t" \
385 "dmtc1 "#gr_t0", "#fr_t0" \n\t" \
386 "punpcklwd "#fr_t0", "#fr_t0", "#fr_t0" \n\t" \
387 "psubw "#fr_t1", "#fr_i1", "#fr_t0" \n\t" \
388 "psllw "#fr_t1", "#fr_t0", "#fr_t1" \n\t" \
389 "paddw "#fr_i0", "#fr_i0", "#fr_t1" \n\t" \
390 "psraw "#fr_i0", "#fr_i0", "#fr_i1" \n\t"