1 # mips test sanity, expected to pass.
4 # ld: -N -Ttext=0x80010000
7 .include "testutils.inc"
9 .macro check_ps psval, upperval, lowerval
12 cvt.s.pu $f0, \psval # upper
13 cvt.s.pl $f2, \psval # lower
16 c.eq.s $fcc0, $f0, $f4
18 c.eq.s $fcc0, $f2, $f6
31 # make sure that Status.FR and .CU1 are set.
33 or $2, $2, (1 << 26) | (1 << 29)
40 1: .dword 0xc1a8000042200000 # -21.0, 40.0
44 check_ps $f8, -21.0, 40.0
51 cvt.ps.s $f8, $f10, $f12 # upper, lower
52 check_ps $f8, 1.0, 3.0
55 writemsg "cvt.ps.s, sdc1, copy, ldc1"
64 cvt.ps.s $f10, $f12, $f14 # upper, lower
71 check_ps $f8, -4.0, 32.0
74 # Load some constants for later use
78 cvt.ps.s $f20, $f10, $f12 # $f20: u=4.0, l=16.0
82 cvt.ps.s $f22, $f10, $f12 # $f22: u=-1.0, l=2.0
86 cvt.ps.s $f24, $f10, $f12 # $f24: u=17.0, l=-8.0
91 pll.ps $f8, $f20, $f22
92 check_ps $f8, 16.0, 2.0
97 plu.ps $f8, $f20, $f22
98 check_ps $f8, 16.0, -1.0
103 pul.ps $f8, $f20, $f22
104 check_ps $f8, 4.0, 2.0
109 puu.ps $f8, $f20, $f22
110 check_ps $f8, 4.0, -1.0
116 check_ps $f8, 1.0, 2.0
122 check_ps $f8, -1.0, 2.0
128 check_ps $f8, 1.0, -2.0
133 add.ps $f8, $f20, $f22
134 check_ps $f8, 3.0, 18.0
139 mul.ps $f8, $f20, $f22
140 check_ps $f8, -4.0, 32.0
145 sub.ps $f8, $f20, $f22
146 check_ps $f8, 5.0, 14.0
151 madd.ps $f8, $f24, $f20, $f22
152 check_ps $f8, 13.0, 24.0
157 msub.ps $f8, $f24, $f20, $f22
158 check_ps $f8, -21.0, 40.0
163 nmadd.ps $f8, $f24, $f20, $f22
164 check_ps $f8, -13.0, -24.0
169 nmsub.ps $f8, $f24, $f20, $f22
170 check_ps $f8, 21.0, -40.0
173 writemsg "movn.ps (n)"
177 movn.ps $f8, $f22, $2 # doesn't move
178 check_ps $f8, 4.0, 16.0
181 writemsg "movn.ps (y)"
185 movn.ps $f8, $f22, $2 # does move
186 check_ps $f8, -1.0, 2.0
189 writemsg "movz.ps (y)"
193 movz.ps $f8, $f22, $2 # does move
194 check_ps $f8, -1.0, 2.0
197 writemsg "movz.ps (n)"
201 movz.ps $f8, $f22, $2 # doesn't move
202 check_ps $f8, 4.0, 16.0
205 writemsg "movf.ps (y,y)"
208 or $2, $2, (1 << 23) | (1 << 25)
209 xor $2, $2, (1 << 23) | (1 << 25)
210 ctc1 $2, $31 # clear fcc0, clear fcc1
212 movf.ps $f8, $f22, $fcc0 # moves both halves
213 check_ps $f8, -1.0, 2.0
216 writemsg "movf.ps (y,n)"
219 or $2, $2, (1 << 23) | (1 << 25)
220 xor $2, $2, (0 << 23) | (1 << 25)
221 ctc1 $2, $31 # set fcc0, clear fcc1
223 movf.ps $f8, $f22, $fcc0 # moves upper half only
224 check_ps $f8, -1.0, 16.0
227 writemsg "movf.ps (n,y)"
230 or $2, $2, (1 << 23) | (1 << 25)
231 xor $2, $2, (1 << 23) | (0 << 25)
232 ctc1 $2, $31 # clear fcc0, set fcc1
234 movf.ps $f8, $f22, $fcc0 # moves lower half only
235 check_ps $f8, 4.0, 2.0
238 writemsg "movf.ps (n,n)"
241 or $2, $2, (1 << 23) | (1 << 25)
242 xor $2, $2, (0 << 23) | (0 << 25)
243 ctc1 $2, $31 # set fcc0, set fcc1
245 movf.ps $f8, $f22, $fcc0 # doesn't move either half
246 check_ps $f8, 4.0, 16.0
249 writemsg "movt.ps (n,n)"
252 or $2, $2, (1 << 23) | (1 << 25)
253 xor $2, $2, (1 << 23) | (1 << 25)
254 ctc1 $2, $31 # clear fcc0, clear fcc1
256 movt.ps $f8, $f22, $fcc0 # doesn't move either half
257 check_ps $f8, 4.0, 16.0
260 writemsg "movt.ps (n,y)"
263 or $2, $2, (1 << 23) | (1 << 25)
264 xor $2, $2, (0 << 23) | (1 << 25)
265 ctc1 $2, $31 # set fcc0, clear fcc1
267 movt.ps $f8, $f22, $fcc0 # moves lower half only
268 check_ps $f8, 4.0, 2.0
271 writemsg "movt.ps (y,n)"
274 or $2, $2, (1 << 23) | (1 << 25)
275 xor $2, $2, (1 << 23) | (0 << 25)
276 ctc1 $2, $31 # clear fcc0, set fcc1
278 movt.ps $f8, $f22, $fcc0 # moves upper half only
279 check_ps $f8, -1.0, 16.0
282 writemsg "movt.ps (y,y)"
285 or $2, $2, (1 << 23) | (1 << 25)
286 xor $2, $2, (0 << 23) | (0 << 25)
287 ctc1 $2, $31 # set fcc0, set fcc1
289 movt.ps $f8, $f22, $fcc0 # moves both halves
290 check_ps $f8, -1.0, 2.0
293 writemsg "alnv.ps (aligned)"
296 1: .dword 0xc1a8000042200000 # -21.0, 40.0
297 .dword 0xc228000041a00000 # -42.0, 20.0
304 alnv.ps $f8, $f10, $f12, $3
305 check_ps $f8, -21.0, 40.0
308 writemsg "alnv.ps (unaligned)"
311 1: .dword 0xc1a8000042200000 # -21.0, 40.0
312 .dword 0xc228000041a00000 # -42.0, 20.0
320 alnv.ps $f8, $f10, $f12, $3
323 bnez $5, 2f # little endian
327 check_ps $f8, 40.0, -42.0
332 check_ps $f8, 20.0, -21.0
336 # We test c.cond.ps only lightly, just to make sure it modifies
337 # two bits and compares the halves separately. Perhaps it should
338 # be tested more thoroughly.
343 or $2, $2, (1 << 23) | (0x7f << 25)
344 ctc1 $2, $31 # set all fcc bits
345 c.f.ps $fcc0, $f8, $f8 # -> f, f
355 or $2, $2, (1 << 23) | (0x7f << 25)
356 xor $2, $2, (1 << 23) | (0x7f << 25)
357 ctc1 $2, $31 # clear all fcc bits
358 c.lt.ps $fcc0, $f22, $f24 # -> f, t