123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- # mips test sanity, expected to pass.
- # mach: mips64 sb1
- # as: -mabi=eabi
- # ld: -N -Ttext=0x80010000
- # output: *\\npass\\n
- .include "testutils.inc"
- .macro check_ps psval, upperval, lowerval
- .set push
- .set noreorder
- cvt.s.pu $f0, \psval # upper
- cvt.s.pl $f2, \psval # lower
- li.s $f4, \upperval
- li.s $f6, \lowerval
- c.eq.s $fcc0, $f0, $f4
- bc1f $fcc0, _fail
- c.eq.s $fcc0, $f2, $f6
- bc1f $fcc0, _fail
- nop
- .set pop
- .endm
- setup
- .set noreorder
- .ent DIAG
- DIAG:
- # make sure that Status.FR and .CU1 are set.
- mfc0 $2, $12
- or $2, $2, (1 << 26) | (1 << 29)
- mtc0 $2, $12
- writemsg "ldc1"
- .data
- 1: .dword 0xc1a8000042200000 # -21.0, 40.0
- .text
- la $2, 1b
- ldc1 $f8, 0($2)
- check_ps $f8, -21.0, 40.0
- writemsg "cvt.ps.s"
- li.s $f10, 1.0
- li.s $f12, 3.0
- cvt.ps.s $f8, $f10, $f12 # upper, lower
- check_ps $f8, 1.0, 3.0
- writemsg "cvt.ps.s, sdc1, copy, ldc1"
- .data
- 1: .dword 0
- .dword 0
- .text
- la $2, 1b
- li.s $f12, -4.0
- li.s $f14, 32.0
- cvt.ps.s $f10, $f12, $f14 # upper, lower
- sdc1 $f10, 8($2)
- lw $3, 8($2)
- lw $4, 12($2)
- sw $3, 0($2)
- sw $4, 4($2)
- ldc1 $f8, 0($2)
- check_ps $f8, -4.0, 32.0
- # Load some constants for later use
- li.s $f10, 4.0
- li.s $f12, 16.0
- cvt.ps.s $f20, $f10, $f12 # $f20: u=4.0, l=16.0
- li.s $f10, -1.0
- li.s $f12, 2.0
- cvt.ps.s $f22, $f10, $f12 # $f22: u=-1.0, l=2.0
- li.s $f10, 17.0
- li.s $f12, -8.0
- cvt.ps.s $f24, $f10, $f12 # $f24: u=17.0, l=-8.0
- writemsg "pll.ps"
- pll.ps $f8, $f20, $f22
- check_ps $f8, 16.0, 2.0
- writemsg "plu.ps"
- plu.ps $f8, $f20, $f22
- check_ps $f8, 16.0, -1.0
- writemsg "pul.ps"
- pul.ps $f8, $f20, $f22
- check_ps $f8, 4.0, 2.0
- writemsg "puu.ps"
- puu.ps $f8, $f20, $f22
- check_ps $f8, 4.0, -1.0
- writemsg "abs.ps"
- abs.ps $f8, $f22
- check_ps $f8, 1.0, 2.0
- writemsg "mov.ps"
- mov.ps $f8, $f22
- check_ps $f8, -1.0, 2.0
- writemsg "neg.ps"
- neg.ps $f8, $f22
- check_ps $f8, 1.0, -2.0
- writemsg "add.ps"
- add.ps $f8, $f20, $f22
- check_ps $f8, 3.0, 18.0
- writemsg "mul.ps"
- mul.ps $f8, $f20, $f22
- check_ps $f8, -4.0, 32.0
- writemsg "sub.ps"
- sub.ps $f8, $f20, $f22
- check_ps $f8, 5.0, 14.0
- writemsg "madd.ps"
- madd.ps $f8, $f24, $f20, $f22
- check_ps $f8, 13.0, 24.0
- writemsg "msub.ps"
- msub.ps $f8, $f24, $f20, $f22
- check_ps $f8, -21.0, 40.0
- writemsg "nmadd.ps"
- nmadd.ps $f8, $f24, $f20, $f22
- check_ps $f8, -13.0, -24.0
- writemsg "nmsub.ps"
- nmsub.ps $f8, $f24, $f20, $f22
- check_ps $f8, 21.0, -40.0
- writemsg "movn.ps (n)"
- li $2, 0
- mov.ps $f8, $f20
- movn.ps $f8, $f22, $2 # doesn't move
- check_ps $f8, 4.0, 16.0
- writemsg "movn.ps (y)"
- li $2, 1
- mov.ps $f8, $f20
- movn.ps $f8, $f22, $2 # does move
- check_ps $f8, -1.0, 2.0
- writemsg "movz.ps (y)"
- li $2, 0
- mov.ps $f8, $f20
- movz.ps $f8, $f22, $2 # does move
- check_ps $f8, -1.0, 2.0
- writemsg "movz.ps (n)"
- li $2, 1
- mov.ps $f8, $f20
- movz.ps $f8, $f22, $2 # doesn't move
- check_ps $f8, 4.0, 16.0
- writemsg "movf.ps (y,y)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (1 << 23) | (1 << 25)
- ctc1 $2, $31 # clear fcc0, clear fcc1
- mov.ps $f8, $f20
- movf.ps $f8, $f22, $fcc0 # moves both halves
- check_ps $f8, -1.0, 2.0
- writemsg "movf.ps (y,n)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (0 << 23) | (1 << 25)
- ctc1 $2, $31 # set fcc0, clear fcc1
- mov.ps $f8, $f20
- movf.ps $f8, $f22, $fcc0 # moves upper half only
- check_ps $f8, -1.0, 16.0
- writemsg "movf.ps (n,y)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (1 << 23) | (0 << 25)
- ctc1 $2, $31 # clear fcc0, set fcc1
- mov.ps $f8, $f20
- movf.ps $f8, $f22, $fcc0 # moves lower half only
- check_ps $f8, 4.0, 2.0
- writemsg "movf.ps (n,n)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (0 << 23) | (0 << 25)
- ctc1 $2, $31 # set fcc0, set fcc1
- mov.ps $f8, $f20
- movf.ps $f8, $f22, $fcc0 # doesn't move either half
- check_ps $f8, 4.0, 16.0
- writemsg "movt.ps (n,n)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (1 << 23) | (1 << 25)
- ctc1 $2, $31 # clear fcc0, clear fcc1
- mov.ps $f8, $f20
- movt.ps $f8, $f22, $fcc0 # doesn't move either half
- check_ps $f8, 4.0, 16.0
- writemsg "movt.ps (n,y)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (0 << 23) | (1 << 25)
- ctc1 $2, $31 # set fcc0, clear fcc1
- mov.ps $f8, $f20
- movt.ps $f8, $f22, $fcc0 # moves lower half only
- check_ps $f8, 4.0, 2.0
- writemsg "movt.ps (y,n)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (1 << 23) | (0 << 25)
- ctc1 $2, $31 # clear fcc0, set fcc1
- mov.ps $f8, $f20
- movt.ps $f8, $f22, $fcc0 # moves upper half only
- check_ps $f8, -1.0, 16.0
- writemsg "movt.ps (y,y)"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (1 << 25)
- xor $2, $2, (0 << 23) | (0 << 25)
- ctc1 $2, $31 # set fcc0, set fcc1
- mov.ps $f8, $f20
- movt.ps $f8, $f22, $fcc0 # moves both halves
- check_ps $f8, -1.0, 2.0
- writemsg "alnv.ps (aligned)"
- .data
- 1: .dword 0xc1a8000042200000 # -21.0, 40.0
- .dword 0xc228000041a00000 # -42.0, 20.0
- .text
- la $2, 1b
- li $3, 0
- addu $4, $3, 8
- luxc1 $f10, $3($2)
- luxc1 $f12, $4($2)
- alnv.ps $f8, $f10, $f12, $3
- check_ps $f8, -21.0, 40.0
- writemsg "alnv.ps (unaligned)"
- .data
- 1: .dword 0xc1a8000042200000 # -21.0, 40.0
- .dword 0xc228000041a00000 # -42.0, 20.0
- .hword 0x0001
- .text
- la $2, 1b
- li $3, 4
- addu $4, $3, 8
- luxc1 $f10, $3($2)
- luxc1 $f12, $4($2)
- alnv.ps $f8, $f10, $f12, $3
- lb $5, 16($2)
- bnez $5, 2f # little endian
- nop
- # big endian
- check_ps $f8, 40.0, -42.0
- b 3f
- nop
- 2:
- # little endian
- check_ps $f8, 20.0, -21.0
- 3:
- # We test c.cond.ps only lightly, just to make sure it modifies
- # two bits and compares the halves separately. Perhaps it should
- # be tested more thoroughly.
- writemsg "c.f.ps"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (0x7f << 25)
- ctc1 $2, $31 # set all fcc bits
- c.f.ps $fcc0, $f8, $f8 # -> f, f
- bc1t $fcc0, _fail
- nop
- bc1t $fcc1, _fail
- nop
-
- writemsg "c.olt.ps"
- cfc1 $2, $31
- or $2, $2, (1 << 23) | (0x7f << 25)
- xor $2, $2, (1 << 23) | (0x7f << 25)
- ctc1 $2, $31 # clear all fcc bits
- c.lt.ps $fcc0, $f22, $f24 # -> f, t
- bc1t $fcc0, _fail
- nop
- bc1f $fcc1, _fail
- nop
-
- pass
- .end DIAG
|