1 # frv testcase for csdiv $GRi,$GRj,$GRk,$CCi,$cond
4 .include "testutils.inc"
10 set_spr_immed 0x1b1b,cccr
12 ; simple division 12 / 3
15 csdiv gr1,gr3,gr2,cc4,1
19 set_gr_limmed 0x0123,0x4567,gr3
20 set_gr_limmed 0xfedc,0xba98,gr1
21 csdiv gr1,gr3,gr2,cc4,1
24 ; Special case from the Arch Spec Vol 2
25 and_spr_immed -33,isr ; turn off isr.edem
26 ; set up exception handler
28 and_spr_immed -4081,tbr ; clear tbr.tt
30 inc_gr_immed 0x170,gr17 ; address of exception handler
35 ; divide will cause overflow
39 set_gr_limmed 0x8000,0x0000,gr1
40 e1: csdiv gr1,gr3,gr2,cc4,1
42 test_gr_limmed 0x8000,0x0000,gr2
44 ; Special case from the Arch Spec Vol 2
45 or_spr_immed 0x20,isr ; turn on isr.edem
47 set_gr_limmed 0x8000,0x0000,gr1
48 csdiv gr1,gr3,gr2,cc4,1
49 test_gr_limmed 0x7fff,0xffff,gr2
51 ; simple division 12 / 3
54 csdiv gr1,gr3,gr2,cc4,0
55 test_gr_limmed 0x7fff,0xffff,gr2
58 set_gr_limmed 0x0123,0x4567,gr3
59 set_gr_limmed 0xfedc,0xba98,gr1
60 csdiv gr1,gr3,gr2,cc4,0
61 test_gr_limmed 0x7fff,0xffff,gr2
63 ; Special case from the Arch Spec Vol 2
64 and_spr_immed -33,isr ; turn off isr.edem
66 set_gr_limmed 0x8000,0x0000,gr1
67 csdiv gr1,gr3,gr2,cc4,0
68 test_gr_limmed 0x7fff,0xffff,gr2
70 or_spr_immed 0x20,isr ; turn on isr.edem
72 set_gr_limmed 0x8000,0x0000,gr1
73 csdiv gr1,gr3,gr2,cc4,0
74 test_gr_limmed 0x7fff,0xffff,gr2
76 ; simple division 12 / 3
79 csdiv gr1,gr3,gr2,cc5,0
83 set_gr_limmed 0x0123,0x4567,gr3
84 set_gr_limmed 0xfedc,0xba98,gr1
85 csdiv gr1,gr3,gr2,cc5,0
88 ; Special case from the Arch Spec Vol 2
89 and_spr_immed -33,isr ; turn off isr.edem
90 ; divide will cause overflow
94 set_gr_limmed 0x8000,0x0000,gr1
95 e2: csdiv gr1,gr3,gr2,cc5,0
97 test_gr_limmed 0x8000,0x0000,gr2
99 ; Special case from the Arch Spec Vol 2
100 or_spr_immed 0x20,isr ; turn on isr.edem
102 set_gr_limmed 0x8000,0x0000,gr1
103 csdiv gr1,gr3,gr2,cc5,0
104 test_gr_limmed 0x7fff,0xffff,gr2
106 ; simple division 12 / 3
109 csdiv gr1,gr3,gr2,cc5,1
110 test_gr_limmed 0x7fff,0xffff,gr2
113 set_gr_limmed 0x0123,0x4567,gr3
114 set_gr_limmed 0xfedc,0xba98,gr1
115 csdiv gr1,gr3,gr2,cc5,1
116 test_gr_limmed 0x7fff,0xffff,gr2
118 ; Special case from the Arch Spec Vol 2
119 and_spr_immed -33,isr ; turn off isr.edem
121 set_gr_limmed 0x8000,0x0000,gr1
122 csdiv gr1,gr3,gr2,cc5,1
123 test_gr_limmed 0x7fff,0xffff,gr2
125 or_spr_immed 0x20,isr ; turn on isr.edem
127 set_gr_limmed 0x8000,0x0000,gr1
128 csdiv gr1,gr3,gr2,cc5,1
129 test_gr_limmed 0x7fff,0xffff,gr2
131 ; simple division 12 / 3
134 csdiv gr1,gr3,gr2,cc6,0
135 test_gr_limmed 0x7fff,0xffff,gr2
138 set_gr_limmed 0x0123,0x4567,gr3
139 set_gr_limmed 0xfedc,0xba98,gr1
140 csdiv gr1,gr3,gr2,cc6,0
141 test_gr_limmed 0x7fff,0xffff,gr2
143 ; Special case from the Arch Spec Vol 2
144 and_spr_immed -33,isr ; turn off isr.edem
146 set_gr_limmed 0x8000,0x0000,gr1
147 csdiv gr1,gr3,gr2,cc6,0
148 test_gr_limmed 0x7fff,0xffff,gr2
150 or_spr_immed 0x20,isr ; turn on isr.edem
152 set_gr_limmed 0x8000,0x0000,gr1
153 csdiv gr1,gr3,gr2,cc6,0
154 test_gr_limmed 0x7fff,0xffff,gr2
156 ; simple division 12 / 3
159 csdiv gr1,gr3,gr2,cc7,1
160 test_gr_limmed 0x7fff,0xffff,gr2
163 set_gr_limmed 0x0123,0x4567,gr3
164 set_gr_limmed 0xfedc,0xba98,gr1
165 csdiv gr1,gr3,gr2,cc7,1
166 test_gr_limmed 0x7fff,0xffff,gr2
168 ; Special case from the Arch Spec Vol 2
169 and_spr_immed -33,isr ; turn off isr.edem
171 set_gr_limmed 0x8000,0x0000,gr1
172 csdiv gr1,gr3,gr2,cc7,1
173 test_gr_limmed 0x7fff,0xffff,gr2
175 or_spr_immed 0x20,isr ; turn on isr.edem
177 set_gr_limmed 0x8000,0x0000,gr1
178 csdiv gr1,gr3,gr2,cc7,1
179 test_gr_limmed 0x7fff,0xffff,gr2
183 ok1: ; exception handler for overflow
184 test_spr_bits 0x18,3,0x2,isr ; isr.dtt is set
185 test_spr_gr epcr0,gr17 ; return address set
186 test_spr_bits 0x0001,0,0x1,esr0 ; esr0 is valid
187 test_spr_bits 0x003e,1,0x13,esr0 ; esr0.ec is set