1 # frv testcase to generate fp_exception
3 .include "testutils.inc"
11 ; clear the packing bit if the insn at 'pack:'. We can't simply use
12 ; '.p' because the assembler will catch the error.
14 and_gr_immed 0x7fffffff,gr10
19 ; Make the the source register number odd at badst. We can't simply
20 ; code an odd register number because the assembler will catch the
23 or_gr_immed 0x02000000,gr10
25 set_gr_addr badst,gr10
28 ; Make the the dest register number odd at badld. We can't simply
29 ; code an odd register number because the assembler will catch the
32 or_gr_immed 0x02000000,gr10
34 set_gr_addr badld,gr10
37 and_spr_immed -4081,tbr ; clear tbr.tt
39 inc_gr_immed 0x070,gr17 ; address of exception handler
41 inc_gr_immed 0x060,gr17 ; address of exception handler
46 inc_gr_immed -4,sp ; for alignment
48 set_gr_immed 0,gr20 ; PC increment
52 set_gr_immed 4,gr20 ; PC increment
53 badst: stdfi fr0,@(sp,0) ; misaligned reg -- slot I0
57 set_gr_immed 8,gr20 ; PC increment
59 badld: lddfi @(sp,0),fr8 ; misaligned reg -- slot I1
63 set_gr_immed 20,gr20 ; PC increment
68 fnegs fr10,fr13 ; packing violation
72 set_gr_immed 4,gr20 ; PC increment
73 bad: .word 0x83e502c4 ; fmadds fr16,fr4,fr1 (unimplemented)
76 and_spr_immed 0xfbffffff,fsr0 ; disable div/0 fp_exception
77 set_fr_iimmed 0x7f7f,0xffff,fr0
78 set_fr_iimmed 0x0000,0x0000,fr1
79 fdivs fr0,fr1,fr2 ; div/0 -- no exception
80 test_spr_bits 0x100000,20,0x0,fsr0 ; fsr0.qne is never set
81 test_spr_bits 0xfc00,10,0x4,fsr0 ; fsr0.aexc is still set
82 test_spr_bits 0xe0000,17,0x0,fsr0 ; fsr0.ftt is clear
85 set_gr_immed 0,gr20 ; PC increment
86 or_spr_immed 0x04000000,fsr0 ; enable div/0 fp_exception
87 set_fr_iimmed 0xdead,0xbeef,fr2
88 div0: fdivs fr0,fr1,fr2 ; fp_exception - div/0
89 test_fr_iimmed 0xdeadbeef,fr2 ; fr2 not updated
92 and_spr_immed 0xfdffffff,fsr0 ; disable inexact fp_exception
93 fsqrts fr32,fr2 ; inexact -- no exception
94 test_spr_bits 0x100000,20,0x0,fsr0 ; fsr0.qne is never set
95 test_spr_bits 0xfc00,10,0x6,fsr0 ; fsr0.aexc is set
96 test_spr_bits 0xe0000,17,0x0,fsr0 ; fsr0.ftt is clear
98 set_fr_fr fr2,fr3 ; sqrt 2
99 set_fr_iimmed 0xdead,0xbeef,fr2
101 or_spr_immed 0x02000000,fsr0 ; enable inexact fp_exception
102 inxt1: fsqrts fr32,fr2 ; fp_exception - inexact
103 test_gr_immed 6,gr15 ; handler called
104 test_fr_fr fr2,fr3 ; fr2 updated
106 set_fr_iimmed 0xdead,0xbeef,fr2
108 inxt2: fsqrts fr32,fr2 ; fp_exception - inexact again
109 test_gr_immed 7,gr15 ; handler called
110 test_fr_fr fr2,fr3 ; fr2 updated
114 ; exception handler 1 -- illegal_instruction: bad insn
116 test_spr_immed 1,esfr1 ; esr0 active
117 test_spr_bits 0x3e,1,0x5,esr0 ; esr0.ec is set
118 test_spr_bits 0x1,0,0x1,esr0 ; esr0.valid is set
121 ; exception handler 2 - fp_exception: divide by 0
123 test_spr_bits 0x100000,20,0x0,fsr0 ; fsr0.qne is clear
124 test_spr_bits 0xe0000,17,0x1,fsr0 ; fsr0.ftt is set
125 test_spr_bits 0xfc00,10,0x4,fsr0 ; fsr0.aexc is still set
127 test_spr_immed 4,esfr1 ; esr2 active
128 test_spr_bits 0x3e,1,0xd,esr2 ; esr2.ec is set
129 test_spr_bits 0x1,0,0x1,esr2 ; esr2.valid is set
130 test_spr_addr div0,epcr2 ; epcr2 is set
133 ; exception handler 3 - illegal_instruction: register exception
135 test_spr_immed 1,esfr1 ; esr0 active
136 test_spr_bits 0x3e,1,0x5,esr0 ; esr0.ec is set
137 test_spr_bits 0x1,0,0x1,esr0 ; esr0.valid is set
140 ; exception handler 4 - illegal_instruction: register exception
142 test_spr_immed 1,esfr1 ; esr0 active
143 test_spr_bits 0x3e,1,0x5,esr0 ; esr0.ec is set
144 test_spr_bits 0x1,0,0x1,esr0 ; esr0.valid is set
147 ; exception handler 5 - illegal_instruction: sequence violation
149 test_spr_immed 1,esfr1 ; esr0 active
150 test_spr_bits 0x3e,1,0x5,esr0 ; esr0.ec is set
151 test_spr_bits 0x1,0,0x1,esr0 ; esr0.valid is set
154 ; exception handler 6 - fp_exception: inexact
156 test_spr_bits 0x100000,20,0x0,fsr0 ; fsr0.qne is clear
157 test_spr_bits 0xe0000,17,0x1,fsr0 ; fsr0.ftt is set
158 test_spr_bits 0xfc00,10,0x6,fsr0 ; fsr0.aexc is still set
160 test_spr_immed 4,esfr1 ; esr2 active
161 test_spr_bits 0x3e,1,0xd,esr2 ; esr2.ec is set
162 test_spr_bits 0x1,0,0x1,esr2 ; esr2.valid is set
163 test_spr_addr inxt1,epcr2 ; epcr2 is set
166 ; exception handler 7 - fp_exception: inexact again
168 test_spr_bits 0x100000,20,0x0,fsr0 ; fsr0.qne is clear
169 test_spr_bits 0xe0000,17,0x1,fsr0 ; fsr0.ftt is set
170 test_spr_bits 0xfc00,10,0x6,fsr0 ; fsr0.aexc is still set
172 test_spr_immed 4,esfr1 ; esr2 active
173 test_spr_bits 0x3e,1,0xd,esr2 ; esr2.ec is set
174 test_spr_bits 0x1,0,0x1,esr2 ; esr2.valid is set
175 test_spr_addr inxt2,epcr2 ; epcr2 is set