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
38 set_gr_limmed 0x8000,0x0000,gr1
39 e1: csdiv gr1,gr3,gr2,cc4,1
41 test_gr_limmed 0x8000,0x0000,gr2
43 ; Special case from the Arch Spec Vol 2
44 or_spr_immed 0x20,isr ; turn on isr.edem
46 set_gr_limmed 0x8000,0x0000,gr1
47 csdiv gr1,gr3,gr2,cc4,1
48 test_gr_limmed 0x7fff,0xffff,gr2
50 ; simple division 12 / 3
53 csdiv gr1,gr3,gr2,cc4,0
54 test_gr_limmed 0x7fff,0xffff,gr2
57 set_gr_limmed 0x0123,0x4567,gr3
58 set_gr_limmed 0xfedc,0xba98,gr1
59 csdiv gr1,gr3,gr2,cc4,0
60 test_gr_limmed 0x7fff,0xffff,gr2
62 ; Special case from the Arch Spec Vol 2
63 and_spr_immed -33,isr ; turn off isr.edem
65 set_gr_limmed 0x8000,0x0000,gr1
66 csdiv gr1,gr3,gr2,cc4,0
67 test_gr_limmed 0x7fff,0xffff,gr2
69 or_spr_immed 0x20,isr ; turn on isr.edem
71 set_gr_limmed 0x8000,0x0000,gr1
72 csdiv gr1,gr3,gr2,cc4,0
73 test_gr_limmed 0x7fff,0xffff,gr2
75 ; simple division 12 / 3
78 csdiv gr1,gr3,gr2,cc5,0
82 set_gr_limmed 0x0123,0x4567,gr3
83 set_gr_limmed 0xfedc,0xba98,gr1
84 csdiv gr1,gr3,gr2,cc5,0
87 ; Special case from the Arch Spec Vol 2
88 and_spr_immed -33,isr ; turn off isr.edem
89 ; divide will cause overflow
92 set_gr_limmed 0x8000,0x0000,gr1
93 e2: csdiv gr1,gr3,gr2,cc5,0
95 test_gr_limmed 0x8000,0x0000,gr2
97 ; Special case from the Arch Spec Vol 2
98 or_spr_immed 0x20,isr ; turn on isr.edem
100 set_gr_limmed 0x8000,0x0000,gr1
101 csdiv gr1,gr3,gr2,cc5,0
102 test_gr_limmed 0x7fff,0xffff,gr2
104 ; simple division 12 / 3
107 csdiv gr1,gr3,gr2,cc5,1
108 test_gr_limmed 0x7fff,0xffff,gr2
111 set_gr_limmed 0x0123,0x4567,gr3
112 set_gr_limmed 0xfedc,0xba98,gr1
113 csdiv gr1,gr3,gr2,cc5,1
114 test_gr_limmed 0x7fff,0xffff,gr2
116 ; Special case from the Arch Spec Vol 2
117 and_spr_immed -33,isr ; turn off isr.edem
119 set_gr_limmed 0x8000,0x0000,gr1
120 csdiv gr1,gr3,gr2,cc5,1
121 test_gr_limmed 0x7fff,0xffff,gr2
123 or_spr_immed 0x20,isr ; turn on isr.edem
125 set_gr_limmed 0x8000,0x0000,gr1
126 csdiv gr1,gr3,gr2,cc5,1
127 test_gr_limmed 0x7fff,0xffff,gr2
129 ; simple division 12 / 3
132 csdiv gr1,gr3,gr2,cc6,0
133 test_gr_limmed 0x7fff,0xffff,gr2
136 set_gr_limmed 0x0123,0x4567,gr3
137 set_gr_limmed 0xfedc,0xba98,gr1
138 csdiv gr1,gr3,gr2,cc6,0
139 test_gr_limmed 0x7fff,0xffff,gr2
141 ; Special case from the Arch Spec Vol 2
142 and_spr_immed -33,isr ; turn off isr.edem
144 set_gr_limmed 0x8000,0x0000,gr1
145 csdiv gr1,gr3,gr2,cc6,0
146 test_gr_limmed 0x7fff,0xffff,gr2
148 or_spr_immed 0x20,isr ; turn on isr.edem
150 set_gr_limmed 0x8000,0x0000,gr1
151 csdiv gr1,gr3,gr2,cc6,0
152 test_gr_limmed 0x7fff,0xffff,gr2
154 ; simple division 12 / 3
157 csdiv gr1,gr3,gr2,cc7,1
158 test_gr_limmed 0x7fff,0xffff,gr2
161 set_gr_limmed 0x0123,0x4567,gr3
162 set_gr_limmed 0xfedc,0xba98,gr1
163 csdiv gr1,gr3,gr2,cc7,1
164 test_gr_limmed 0x7fff,0xffff,gr2
166 ; Special case from the Arch Spec Vol 2
167 and_spr_immed -33,isr ; turn off isr.edem
169 set_gr_limmed 0x8000,0x0000,gr1
170 csdiv gr1,gr3,gr2,cc7,1
171 test_gr_limmed 0x7fff,0xffff,gr2
173 or_spr_immed 0x20,isr ; turn on isr.edem
175 set_gr_limmed 0x8000,0x0000,gr1
176 csdiv gr1,gr3,gr2,cc7,1
177 test_gr_limmed 0x7fff,0xffff,gr2
181 ok1: ; exception handler for overflow
182 test_spr_bits 0x18,3,0x2,isr ; isr.dtt is set
183 test_spr_bits 0x0001,0,0x1,esr0 ; esr0 is valid
184 test_spr_bits 0x003e,1,0x13,esr0 ; esr0.ec is set