Automatic date update in version.in
[binutils-gdb.git] / sim / testsuite / mips / fpu64-ps.s
blobad493b8ac3104f02ba369bbe94297967c308167d
1 # mips test sanity, expected to pass.
2 # mach: mips64 sb1
3 # as: -mabi=eabi
4 # ld: -N -Ttext=0x80010000
5 # output: *\\npass\\n
7 .include "testutils.inc"
9 .macro check_ps psval, upperval, lowerval
10 .set push
11 .set noreorder
12 cvt.s.pu $f0, \psval # upper
13 cvt.s.pl $f2, \psval # lower
14 li.s $f4, \upperval
15 li.s $f6, \lowerval
16 c.eq.s $fcc0, $f0, $f4
17 bc1f $fcc0, _fail
18 c.eq.s $fcc0, $f2, $f6
19 bc1f $fcc0, _fail
20 nop
21 .set pop
22 .endm
24 setup
26 .set noreorder
28 .ent DIAG
29 DIAG:
31 # make sure that Status.FR and .CU1 are set.
32 mfc0 $2, $12
33 or $2, $2, (1 << 26) | (1 << 29)
34 mtc0 $2, $12
37 writemsg "ldc1"
39 .data
40 1: .dword 0xc1a8000042200000 # -21.0, 40.0
41 .text
42 la $2, 1b
43 ldc1 $f8, 0($2)
44 check_ps $f8, -21.0, 40.0
47 writemsg "cvt.ps.s"
49 li.s $f10, 1.0
50 li.s $f12, 3.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"
57 .data
58 1: .dword 0
59 .dword 0
60 .text
61 la $2, 1b
62 li.s $f12, -4.0
63 li.s $f14, 32.0
64 cvt.ps.s $f10, $f12, $f14 # upper, lower
65 sdc1 $f10, 8($2)
66 lw $3, 8($2)
67 lw $4, 12($2)
68 sw $3, 0($2)
69 sw $4, 4($2)
70 ldc1 $f8, 0($2)
71 check_ps $f8, -4.0, 32.0
74 # Load some constants for later use
76 li.s $f10, 4.0
77 li.s $f12, 16.0
78 cvt.ps.s $f20, $f10, $f12 # $f20: u=4.0, l=16.0
80 li.s $f10, -1.0
81 li.s $f12, 2.0
82 cvt.ps.s $f22, $f10, $f12 # $f22: u=-1.0, l=2.0
84 li.s $f10, 17.0
85 li.s $f12, -8.0
86 cvt.ps.s $f24, $f10, $f12 # $f24: u=17.0, l=-8.0
89 writemsg "pll.ps"
91 pll.ps $f8, $f20, $f22
92 check_ps $f8, 16.0, 2.0
95 writemsg "plu.ps"
97 plu.ps $f8, $f20, $f22
98 check_ps $f8, 16.0, -1.0
101 writemsg "pul.ps"
103 pul.ps $f8, $f20, $f22
104 check_ps $f8, 4.0, 2.0
107 writemsg "puu.ps"
109 puu.ps $f8, $f20, $f22
110 check_ps $f8, 4.0, -1.0
113 writemsg "abs.ps"
115 abs.ps $f8, $f22
116 check_ps $f8, 1.0, 2.0
119 writemsg "mov.ps"
121 mov.ps $f8, $f22
122 check_ps $f8, -1.0, 2.0
125 writemsg "neg.ps"
127 neg.ps $f8, $f22
128 check_ps $f8, 1.0, -2.0
131 writemsg "add.ps"
133 add.ps $f8, $f20, $f22
134 check_ps $f8, 3.0, 18.0
137 writemsg "mul.ps"
139 mul.ps $f8, $f20, $f22
140 check_ps $f8, -4.0, 32.0
143 writemsg "sub.ps"
145 sub.ps $f8, $f20, $f22
146 check_ps $f8, 5.0, 14.0
149 writemsg "madd.ps"
151 madd.ps $f8, $f24, $f20, $f22
152 check_ps $f8, 13.0, 24.0
155 writemsg "msub.ps"
157 msub.ps $f8, $f24, $f20, $f22
158 check_ps $f8, -21.0, 40.0
161 writemsg "nmadd.ps"
163 nmadd.ps $f8, $f24, $f20, $f22
164 check_ps $f8, -13.0, -24.0
167 writemsg "nmsub.ps"
169 nmsub.ps $f8, $f24, $f20, $f22
170 check_ps $f8, 21.0, -40.0
173 writemsg "movn.ps (n)"
175 li $2, 0
176 mov.ps $f8, $f20
177 movn.ps $f8, $f22, $2 # doesn't move
178 check_ps $f8, 4.0, 16.0
181 writemsg "movn.ps (y)"
183 li $2, 1
184 mov.ps $f8, $f20
185 movn.ps $f8, $f22, $2 # does move
186 check_ps $f8, -1.0, 2.0
189 writemsg "movz.ps (y)"
191 li $2, 0
192 mov.ps $f8, $f20
193 movz.ps $f8, $f22, $2 # does move
194 check_ps $f8, -1.0, 2.0
197 writemsg "movz.ps (n)"
199 li $2, 1
200 mov.ps $f8, $f20
201 movz.ps $f8, $f22, $2 # doesn't move
202 check_ps $f8, 4.0, 16.0
205 writemsg "movf.ps (y,y)"
207 cfc1 $2, $31
208 or $2, $2, (1 << 23) | (1 << 25)
209 xor $2, $2, (1 << 23) | (1 << 25)
210 ctc1 $2, $31 # clear fcc0, clear fcc1
211 mov.ps $f8, $f20
212 movf.ps $f8, $f22, $fcc0 # moves both halves
213 check_ps $f8, -1.0, 2.0
216 writemsg "movf.ps (y,n)"
218 cfc1 $2, $31
219 or $2, $2, (1 << 23) | (1 << 25)
220 xor $2, $2, (0 << 23) | (1 << 25)
221 ctc1 $2, $31 # set fcc0, clear fcc1
222 mov.ps $f8, $f20
223 movf.ps $f8, $f22, $fcc0 # moves upper half only
224 check_ps $f8, -1.0, 16.0
227 writemsg "movf.ps (n,y)"
229 cfc1 $2, $31
230 or $2, $2, (1 << 23) | (1 << 25)
231 xor $2, $2, (1 << 23) | (0 << 25)
232 ctc1 $2, $31 # clear fcc0, set fcc1
233 mov.ps $f8, $f20
234 movf.ps $f8, $f22, $fcc0 # moves lower half only
235 check_ps $f8, 4.0, 2.0
238 writemsg "movf.ps (n,n)"
240 cfc1 $2, $31
241 or $2, $2, (1 << 23) | (1 << 25)
242 xor $2, $2, (0 << 23) | (0 << 25)
243 ctc1 $2, $31 # set fcc0, set fcc1
244 mov.ps $f8, $f20
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)"
251 cfc1 $2, $31
252 or $2, $2, (1 << 23) | (1 << 25)
253 xor $2, $2, (1 << 23) | (1 << 25)
254 ctc1 $2, $31 # clear fcc0, clear fcc1
255 mov.ps $f8, $f20
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)"
262 cfc1 $2, $31
263 or $2, $2, (1 << 23) | (1 << 25)
264 xor $2, $2, (0 << 23) | (1 << 25)
265 ctc1 $2, $31 # set fcc0, clear fcc1
266 mov.ps $f8, $f20
267 movt.ps $f8, $f22, $fcc0 # moves lower half only
268 check_ps $f8, 4.0, 2.0
271 writemsg "movt.ps (y,n)"
273 cfc1 $2, $31
274 or $2, $2, (1 << 23) | (1 << 25)
275 xor $2, $2, (1 << 23) | (0 << 25)
276 ctc1 $2, $31 # clear fcc0, set fcc1
277 mov.ps $f8, $f20
278 movt.ps $f8, $f22, $fcc0 # moves upper half only
279 check_ps $f8, -1.0, 16.0
282 writemsg "movt.ps (y,y)"
284 cfc1 $2, $31
285 or $2, $2, (1 << 23) | (1 << 25)
286 xor $2, $2, (0 << 23) | (0 << 25)
287 ctc1 $2, $31 # set fcc0, set fcc1
288 mov.ps $f8, $f20
289 movt.ps $f8, $f22, $fcc0 # moves both halves
290 check_ps $f8, -1.0, 2.0
293 writemsg "alnv.ps (aligned)"
295 .data
296 1: .dword 0xc1a8000042200000 # -21.0, 40.0
297 .dword 0xc228000041a00000 # -42.0, 20.0
298 .text
299 la $2, 1b
300 li $3, 0
301 addu $4, $3, 8
302 luxc1 $f10, $3($2)
303 luxc1 $f12, $4($2)
304 alnv.ps $f8, $f10, $f12, $3
305 check_ps $f8, -21.0, 40.0
308 writemsg "alnv.ps (unaligned)"
310 .data
311 1: .dword 0xc1a8000042200000 # -21.0, 40.0
312 .dword 0xc228000041a00000 # -42.0, 20.0
313 .hword 0x0001
314 .text
315 la $2, 1b
316 li $3, 4
317 addu $4, $3, 8
318 luxc1 $f10, $3($2)
319 luxc1 $f12, $4($2)
320 alnv.ps $f8, $f10, $f12, $3
322 lb $5, 16($2)
323 bnez $5, 2f # little endian
326 # big endian
327 check_ps $f8, 40.0, -42.0
328 b 3f
331 # little endian
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.
340 writemsg "c.f.ps"
342 cfc1 $2, $31
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
346 bc1t $fcc0, _fail
348 bc1t $fcc1, _fail
352 writemsg "c.olt.ps"
354 cfc1 $2, $31
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
359 bc1t $fcc0, _fail
361 bc1f $fcc1, _fail
365 pass
367 .end DIAG