5#ifndef QT_MIPS_ASM_DSP_H
6#define QT_MIPS_ASM_DSP_H
20#pragma qt_sync_stop_processing
60
61
62#define LEAF_MIPS32R2(symbol)
65 .type symbol,@function;
72
73
74#define LEAF_MIPS_DSP(symbol) LEAF_MIPS32R2
79
80
81#define LEAF_MIPS_DSPR2(symbol) LEAF_MIPS32R2
86
87
91 .size function,.-function
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114.macro BYTE_MUL_x2 in_1, in_2, out_1, out_2
115 repl_a1, repl_a2, rounding_factor,
116 scratch1, scratch2, scratch3, scratch4,
118 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
119 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
120 muleu_s.ph.qbl \scratch3, \in_2, \repl_a2
121 muleu_s.ph.qbr \scratch4, \in_2, \repl_a2
124 preceu.ph.qbla \repl_a1, \scratch1
125 preceu.ph.qbla \repl_a2, \scratch2
126 preceu.ph.qbla \out_1, \scratch3
127 preceu.ph.qbla \out_2, \scratch4
129 addu \scratch1, \repl_a1, \scratch1
130 addu \scratch2, \repl_a2, \scratch2
132 preceu.ph.qbla \in_1, \scratch1
133 preceu.ph.qbla \in_2, \scratch2
134 preceu.ph.qbla \out_1, \scratch3
135 preceu.ph.qbla \out_2, \scratch4
137 addu \scratch1, \in_1, \scratch1
138 addu \scratch2, \in_2, \scratch2
141 addu \out_1, \out_1, \scratch3
142 addu \out_2, \out_2, \scratch4
144 addu \scratch1, \scratch1, \rounding_factor
145 addu \scratch2, \scratch2, \rounding_factor
146 addu \scratch3, \out_1, \rounding_factor
147 addu \scratch4, \out_2, \rounding_factor
149 precrq.qb.ph \out_1, \scratch1, \scratch2
150 precrq.qb.ph \out_2, \scratch3, \scratch4
155
156
157
158
159
160
161
162
163
164
165
166
167.macro BYTE_MUL in_1, out_1,
168 repl_a1, rounding_factor,
169 scratch1, scratch2, scratch3, scratch4
170 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
171 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
173 preceu.ph.qbla \scratch3, \scratch1
174 preceu.ph.qbla \scratch4, \scratch2
176 addu \scratch1, \scratch1, \scratch3
177 addu \scratch1, \scratch1, \rounding_factor
179 addu \scratch2, \scratch2, \scratch4
180 addu \scratch2, \scratch2, \rounding_factor
182 precrq.qb.ph \out_1, \scratch1, \scratch2
187
188
189
190
191
192
193
194
195
196
197
198.macro INTERPOLATE_PIXEL_255 in_1, mul_1,
201 rounding_factor, andi_factor
202 scratch1, scratch2, scratch3, scratch4
204 preceu.ph.qbra \scratch1, \in_1
205 preceu.ph.qbra \scratch2, \in_2
206 mul \scratch1, \scratch1, \mul_1
207 mul \scratch2, \scratch2, \mul_2
209 preceu.ph.qbla \scratch3, \in_1
210 preceu.ph.qbla \scratch4, \in_2
211 mul \scratch3, \scratch3, \mul_1
212 mul \scratch4, \scratch4, \mul_2
214 addu \scratch1, \scratch1, \scratch2
215 preceu.ph.qbla \scratch2, \scratch1
216 addu \scratch1, \scratch1, \scratch2
217 addu \scratch1, \scratch1, \rounding_factor
218 preceu.ph.qbla \scratch1, \scratch1
220 addu \scratch3, \scratch3, \scratch4
221 preceu.ph.qbla \scratch4, \scratch3
222 addu \scratch3, \scratch3, \scratch4
223 addu \scratch3, \scratch3, \rounding_factor
224 and \scratch3, \scratch3, \andi_factor
226 or \out_1, \scratch1, \scratch3
230
231
232
233
234
235
236
237.macro CHECK_STACK_OFFSET regs_num, stack_offset
238.
if \stack_offset < \regs_num * 4 - 16
239.error
"Stack offset too small."
244
245
246
247
248
249
250
251
252
253
254.macro SAVE_REGS_ON_STACK stack_offset = 0, r1,
255 r2 = 0, r3 = 0, r4 = 0,
256 r5 = 0, r6 = 0, r7 = 0,
257 r8 = 0, r9 = 0, r10 = 0,
258 r11 = 0, r12 = 0, r13 = 0,
260 .
if (\stack_offset < 0) || (\stack_offset - (\stack_offset / 4) * 4)
261 .error
"Stack offset must be positive and multiple of 4."
263 .
if \stack_offset != 0
264 addiu
sp,
sp, -\stack_offset
277 CHECK_STACK_OFFSET 5, \stack_offset
281 CHECK_STACK_OFFSET 6, \stack_offset
285 CHECK_STACK_OFFSET 7, \stack_offset
289 CHECK_STACK_OFFSET 8, \stack_offset
293 CHECK_STACK_OFFSET 9, \stack_offset
297 CHECK_STACK_OFFSET 10, \stack_offset
301 CHECK_STACK_OFFSET 11, \stack_offset
305 CHECK_STACK_OFFSET 12, \stack_offset
309 CHECK_STACK_OFFSET 13, \stack_offset
313 CHECK_STACK_OFFSET 14, \stack_offset
319
320
321
322
323
324
325
326
327
328
329.macro RESTORE_REGS_FROM_STACK stack_offset = 0, r1,
330 r2 = 0, r3 = 0, r4 = 0,
331 r5 = 0, r6 = 0, r7 = 0,
332 r8 = 0, r9 = 0, r10 = 0,
333 r11 = 0, r12 = 0, r13 = 0,
335 .
if (\stack_offset < 0) || (\stack_offset - (\stack_offset/4)*4)
336 .error
"Stack offset must be pozitive and multiple of 4."
349 CHECK_STACK_OFFSET 5, \stack_offset
353 CHECK_STACK_OFFSET 6, \stack_offset
357 CHECK_STACK_OFFSET 7, \stack_offset
361 CHECK_STACK_OFFSET 8, \stack_offset
365 CHECK_STACK_OFFSET 9, \stack_offset
369 CHECK_STACK_OFFSET 10, \stack_offset
373 CHECK_STACK_OFFSET 11, \stack_offset
377 CHECK_STACK_OFFSET 12, \stack_offset
381 CHECK_STACK_OFFSET 13, \stack_offset
385 CHECK_STACK_OFFSET 14, \stack_offset
388 .
if \stack_offset != 0
389 addiu
sp,
sp, \stack_offset