4#ifndef QT_MIPS_ASM_DSP_H
5#define QT_MIPS_ASM_DSP_H
19#pragma qt_sync_stop_processing
59
60
61#define LEAF_MIPS32R2(symbol)
64 .type symbol,@function;
71
72
73#define LEAF_MIPS_DSP(symbol) LEAF_MIPS32R2
78
79
80#define LEAF_MIPS_DSPR2(symbol) LEAF_MIPS32R2
85
86
90 .size function,.-function
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113.macro BYTE_MUL_x2 in_1, in_2, out_1, out_2
114 repl_a1, repl_a2, rounding_factor,
115 scratch1, scratch2, scratch3, scratch4,
117 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
118 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
119 muleu_s.ph.qbl \scratch3, \in_2, \repl_a2
120 muleu_s.ph.qbr \scratch4, \in_2, \repl_a2
123 preceu.ph.qbla \repl_a1, \scratch1
124 preceu.ph.qbla \repl_a2, \scratch2
125 preceu.ph.qbla \out_1, \scratch3
126 preceu.ph.qbla \out_2, \scratch4
128 addu \scratch1, \repl_a1, \scratch1
129 addu \scratch2, \repl_a2, \scratch2
131 preceu.ph.qbla \in_1, \scratch1
132 preceu.ph.qbla \in_2, \scratch2
133 preceu.ph.qbla \out_1, \scratch3
134 preceu.ph.qbla \out_2, \scratch4
136 addu \scratch1, \in_1, \scratch1
137 addu \scratch2, \in_2, \scratch2
140 addu \out_1, \out_1, \scratch3
141 addu \out_2, \out_2, \scratch4
143 addu \scratch1, \scratch1, \rounding_factor
144 addu \scratch2, \scratch2, \rounding_factor
145 addu \scratch3, \out_1, \rounding_factor
146 addu \scratch4, \out_2, \rounding_factor
148 precrq.qb.ph \out_1, \scratch1, \scratch2
149 precrq.qb.ph \out_2, \scratch3, \scratch4
154
155
156
157
158
159
160
161
162
163
164
165
166.macro BYTE_MUL in_1, out_1,
167 repl_a1, rounding_factor,
168 scratch1, scratch2, scratch3, scratch4
169 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
170 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
172 preceu.ph.qbla \scratch3, \scratch1
173 preceu.ph.qbla \scratch4, \scratch2
175 addu \scratch1, \scratch1, \scratch3
176 addu \scratch1, \scratch1, \rounding_factor
178 addu \scratch2, \scratch2, \scratch4
179 addu \scratch2, \scratch2, \rounding_factor
181 precrq.qb.ph \out_1, \scratch1, \scratch2
186
187
188
189
190
191
192
193
194
195
196
197.macro INTERPOLATE_PIXEL_255 in_1, mul_1,
200 rounding_factor, andi_factor
201 scratch1, scratch2, scratch3, scratch4
203 preceu.ph.qbra \scratch1, \in_1
204 preceu.ph.qbra \scratch2, \in_2
205 mul \scratch1, \scratch1, \mul_1
206 mul \scratch2, \scratch2, \mul_2
208 preceu.ph.qbla \scratch3, \in_1
209 preceu.ph.qbla \scratch4, \in_2
210 mul \scratch3, \scratch3, \mul_1
211 mul \scratch4, \scratch4, \mul_2
213 addu \scratch1, \scratch1, \scratch2
214 preceu.ph.qbla \scratch2, \scratch1
215 addu \scratch1, \scratch1, \scratch2
216 addu \scratch1, \scratch1, \rounding_factor
217 preceu.ph.qbla \scratch1, \scratch1
219 addu \scratch3, \scratch3, \scratch4
220 preceu.ph.qbla \scratch4, \scratch3
221 addu \scratch3, \scratch3, \scratch4
222 addu \scratch3, \scratch3, \rounding_factor
223 and \scratch3, \scratch3, \andi_factor
225 or \out_1, \scratch1, \scratch3
229
230
231
232
233
234
235
236.macro CHECK_STACK_OFFSET regs_num, stack_offset
237.
if \stack_offset < \regs_num * 4 - 16
238.error
"Stack offset too small."
243
244
245
246
247
248
249
250
251
252
253.macro SAVE_REGS_ON_STACK stack_offset = 0, r1,
254 r2 = 0, r3 = 0, r4 = 0,
255 r5 = 0, r6 = 0, r7 = 0,
256 r8 = 0, r9 = 0, r10 = 0,
257 r11 = 0, r12 = 0, r13 = 0,
259 .
if (\stack_offset < 0) || (\stack_offset - (\stack_offset / 4) * 4)
260 .error
"Stack offset must be positive and multiple of 4."
262 .
if \stack_offset != 0
263 addiu
sp,
sp, -\stack_offset
276 CHECK_STACK_OFFSET 5, \stack_offset
280 CHECK_STACK_OFFSET 6, \stack_offset
284 CHECK_STACK_OFFSET 7, \stack_offset
288 CHECK_STACK_OFFSET 8, \stack_offset
292 CHECK_STACK_OFFSET 9, \stack_offset
296 CHECK_STACK_OFFSET 10, \stack_offset
300 CHECK_STACK_OFFSET 11, \stack_offset
304 CHECK_STACK_OFFSET 12, \stack_offset
308 CHECK_STACK_OFFSET 13, \stack_offset
312 CHECK_STACK_OFFSET 14, \stack_offset
318
319
320
321
322
323
324
325
326
327
328.macro RESTORE_REGS_FROM_STACK stack_offset = 0, r1,
329 r2 = 0, r3 = 0, r4 = 0,
330 r5 = 0, r6 = 0, r7 = 0,
331 r8 = 0, r9 = 0, r10 = 0,
332 r11 = 0, r12 = 0, r13 = 0,
334 .
if (\stack_offset < 0) || (\stack_offset - (\stack_offset/4)*4)
335 .error
"Stack offset must be pozitive and multiple of 4."
348 CHECK_STACK_OFFSET 5, \stack_offset
352 CHECK_STACK_OFFSET 6, \stack_offset
356 CHECK_STACK_OFFSET 7, \stack_offset
360 CHECK_STACK_OFFSET 8, \stack_offset
364 CHECK_STACK_OFFSET 9, \stack_offset
368 CHECK_STACK_OFFSET 10, \stack_offset
372 CHECK_STACK_OFFSET 11, \stack_offset
376 CHECK_STACK_OFFSET 12, \stack_offset
380 CHECK_STACK_OFFSET 13, \stack_offset
384 CHECK_STACK_OFFSET 14, \stack_offset
387 .
if \stack_offset != 0
388 addiu
sp,
sp, \stack_offset