1 # frv testcase for smass $GRi,$GRj
4 .include "../testutils.inc"
11 set_gr_immed 3,gr7 ; multiply small numbers
13 set_spr_immed 0,iacc0h
14 set_spr_immed 1,iacc0l
18 test_spr_immed 7,iacc0l ; result 3*2+1
19 test_spr_immed 0,iacc0h
21 set_gr_immed 1,gr7 ; multiply by 1
23 set_spr_immed 0,iacc0h
24 set_spr_immed 1,iacc0l
28 test_spr_immed 3,iacc0l ; result 1*2+1
29 test_spr_immed 0,iacc0h
31 set_gr_immed 2,gr7 ; multiply by 1
33 set_spr_immed 0,iacc0h
34 set_spr_immed 1,iacc0l
38 test_spr_immed 3,iacc0l ; result 2*1+1
39 test_spr_immed 0,iacc0h
41 set_gr_immed 0,gr7 ; multiply by 0
43 set_spr_immed 0,iacc0h
44 set_spr_immed 1,iacc0l
48 test_spr_immed 1,iacc0l ; result 0*2+1
49 test_spr_immed 0,iacc0h
51 set_gr_immed 2,gr7 ; multiply by 0
53 set_spr_immed 0,iacc0h
54 set_spr_immed 1,iacc0l
58 test_spr_immed 1,iacc0l ; result 2*0+1
59 test_spr_immed 0,iacc0h
61 set_gr_limmed 0x3fff,0xffff,gr7 ; 31 bit result
63 set_spr_immed 0,iacc0h
64 set_spr_immed 1,iacc0l
67 test_gr_limmed 0x3fff,0xffff,gr7
68 test_spr_limmed 0x7fff,0xffff,iacc0l ; 3fffffff*2+1
69 test_spr_immed 0,iacc0h
71 set_gr_limmed 0x4000,0x0000,gr7 ; 32 bit result
73 set_spr_immed 0,iacc0h
74 set_spr_immed 1,iacc0l
77 test_gr_limmed 0x4000,0x0000,gr7
78 test_spr_limmed 0x8000,0x0001,iacc0l ; 40000000*2+1
79 test_spr_immed 0,iacc0h
81 set_gr_limmed 0x4000,0x0000,gr7 ; 33 bit result
83 set_spr_immed 0,iacc0h
84 set_spr_immed 1,iacc0l
87 test_gr_limmed 0x4000,0x0000,gr7
88 test_spr_immed 1,iacc0l ; 40000000*4+1
89 test_spr_immed 1,iacc0h
91 set_gr_limmed 0x7fff,0xffff,gr7 ; max positive result
92 set_gr_limmed 0x7fff,0xffff,gr8
93 set_spr_immed 0,iacc0h
94 set_spr_immed 1,iacc0l
96 test_gr_limmed 0x7fff,0xffff,gr8
97 test_gr_limmed 0x7fff,0xffff,gr7
98 test_spr_immed 0x00000002,iacc0l ; 7fffffff*7fffffff+1
99 test_spr_limmed 0x3fff,0xffff,iacc0h
102 set_gr_immed -3,gr7 ; multiply small numbers
104 set_spr_immed 0,iacc0h
105 set_spr_immed 1,iacc0l
109 test_spr_immed -5,iacc0l ; -3*2+1
110 test_spr_immed -1,iacc0h
112 set_gr_immed 3,gr7 ; multiply small numbers
114 set_spr_immed 0,iacc0h
115 set_spr_immed 1,iacc0l
119 test_spr_immed -5,iacc0l ; 3*-2+1
120 test_spr_immed -1,iacc0h
122 set_gr_immed 1,gr7 ; multiply by 1
124 set_spr_immed 0,iacc0h
125 set_spr_immed 1,iacc0l
129 test_spr_immed -1,iacc0l ; 1*-2+1
130 test_spr_immed -1,iacc0h
132 set_gr_immed -2,gr7 ; multiply by 1
134 set_spr_immed 0,iacc0h
135 set_spr_immed 1,iacc0l
139 test_spr_immed -1,iacc0l ; -2*1+1
140 test_spr_immed -1,iacc0h
142 set_gr_immed 0,gr7 ; multiply by 0
144 set_spr_immed 0,iacc0h
145 set_spr_immed 1,iacc0l
149 test_spr_immed 1,iacc0l ; 0*-2+1
150 test_spr_immed 0,iacc0h
152 set_gr_immed -2,gr7 ; multiply by 0
154 set_spr_immed 0,iacc0h
155 set_spr_immed 1,iacc0l
159 test_spr_immed 1,iacc0l ; -2*0+1
160 test_spr_immed 0,iacc0h
162 set_gr_limmed 0x2000,0x0001,gr7 ; 31 bit result
164 set_spr_immed 0,iacc0h
165 set_spr_immed 1,iacc0l
168 test_gr_limmed 0x2000,0x0001,gr7
169 test_spr_limmed 0xbfff,0xffff,iacc0l ; 20000001*-2+1
170 test_spr_limmed 0xffff,0xffff,iacc0h
172 set_gr_limmed 0x4000,0x0000,gr7 ; 32 bit result
174 set_spr_immed 0,iacc0h
175 set_spr_immed 1,iacc0l
178 test_gr_limmed 0x4000,0x0000,gr7
179 test_spr_limmed 0x8000,0x0001,iacc0l ; 40000000*-2+1
180 test_spr_limmed 0xffff,0xffff,iacc0h
182 set_gr_limmed 0x4000,0x0001,gr7 ; 32 bit result
184 set_spr_immed 0,iacc0h
185 set_spr_immed 1,iacc0l
188 test_gr_limmed 0x4000,0x0001,gr7
189 test_spr_limmed 0x7fff,0xffff,iacc0l ; 40000001*-2+1
190 test_spr_limmed 0xffff,0xffff,iacc0h
192 set_gr_limmed 0x4000,0x0000,gr7 ; 33 bit result
194 set_spr_immed 0,iacc0h
195 set_spr_immed 1,iacc0l
198 test_gr_limmed 0x4000,0x0000,gr7
199 test_spr_limmed 0x0000,0x0001,iacc0l ; 40000000*-4+1
200 test_spr_limmed 0xffff,0xffff,iacc0h
202 set_gr_limmed 0x7fff,0xffff,gr7 ; max negative result
203 set_gr_limmed 0x8000,0x0000,gr8
204 set_spr_immed 0,iacc0h
205 set_spr_immed 1,iacc0l
207 test_gr_limmed 0x8000,0x0000,gr8
208 test_gr_limmed 0x7fff,0xffff,gr7
209 test_spr_limmed 0x8000,0x0001,iacc0l ; 7fffffff*80000000+1
210 test_spr_limmed 0xc000,0x0000,iacc0h
213 set_gr_immed -3,gr7 ; multiply small numbers
215 set_spr_immed 0,iacc0h
216 set_spr_immed 1,iacc0l
220 test_spr_immed 7,iacc0l ; -3*-2+1
221 test_spr_immed 0,iacc0h
223 set_gr_immed -1,gr7 ; multiply by 1
225 set_spr_immed 0,iacc0h
226 set_spr_immed 1,iacc0l
230 test_spr_immed 3,iacc0l ; -1*-2+1
231 test_spr_immed 0,iacc0h
233 set_gr_immed -2,gr7 ; multiply by 1
235 set_spr_immed 0,iacc0h
236 set_spr_immed 1,iacc0l
240 test_spr_immed 3,iacc0l ; -2*-1+1
241 test_spr_immed 0,iacc0h
243 set_gr_limmed 0xc000,0x0001,gr7 ; 31 bit result
245 set_spr_immed 0,iacc0h
246 set_spr_immed 1,iacc0l
249 test_gr_limmed 0xc000,0x0001,gr7
250 test_spr_limmed 0x7fff,0xffff,iacc0l ; c0000001*-2+1
251 test_spr_immed 0,iacc0h
253 set_gr_limmed 0xc000,0x0000,gr7 ; 32 bit result
255 set_spr_immed 0,iacc0h
256 set_spr_immed 1,iacc0l
259 test_gr_limmed 0xc000,0x0000,gr7
260 test_spr_limmed 0x8000,0x0001,iacc0l ; c0000000*-2+1
261 test_spr_immed 0,iacc0h
263 set_gr_limmed 0xc000,0x0000,gr7 ; 33 bit result
265 set_spr_immed 0,iacc0h
266 set_spr_immed 1,iacc0l
269 test_gr_limmed 0xc000,0x0000,gr7
270 test_spr_immed 0x00000001,iacc0l ; c0000000*-4+1
271 test_spr_immed 1,iacc0h
273 set_gr_limmed 0x8000,0x0001,gr7 ; almost max positive result
274 set_gr_limmed 0x8000,0x0001,gr8
275 set_spr_immed 0,iacc0h
276 set_spr_immed 1,iacc0l
278 test_gr_limmed 0x8000,0x0001,gr8
279 test_gr_limmed 0x8000,0x0001,gr7
280 test_spr_immed 0x00000002,iacc0l ; 80000001*80000001+1
281 test_spr_limmed 0x3fff,0xffff,iacc0h
283 set_gr_limmed 0x8000,0x0000,gr7 ; max positive result
284 set_gr_limmed 0x8000,0x0000,gr8
285 set_spr_immed 0,iacc0h
286 set_spr_immed 1,iacc0l
288 test_gr_limmed 0x8000,0x0000,gr8
289 test_gr_limmed 0x8000,0x0000,gr7
290 test_spr_immed 0x00000001,iacc0l ; 80000000*80000000+1
291 test_spr_limmed 0x4000,0x0000,iacc0h
294 set_gr_limmed 0x7fff,0xffff,gr7 ; not quite overflow (pos)
295 set_gr_limmed 0x7fff,0xffff,gr8
296 set_spr_limmed 0xffff,0xfffe,iacc0l
297 set_spr_limmed 0x4000,0x0000,iacc0h
299 test_gr_limmed 0x7fff,0xffff,gr8
300 test_gr_limmed 0x7fff,0xffff,gr7
301 test_spr_limmed 0xffff,0xffff,iacc0l ; 7fffffff*7fffffff+
302 test_spr_limmed 0x7fff,0xffff,iacc0h ; 40000000fffffffe
305 set_gr_limmed 0x7fff,0xffff,gr7 ; just barely overflow (pos)
306 set_gr_limmed 0x7fff,0xffff,gr8
307 set_spr_limmed 0xffff,0xffff,iacc0l
308 set_spr_limmed 0x4000,0x0000,iacc0h
310 test_gr_limmed 0x7fff,0xffff,gr8
311 test_gr_limmed 0x7fff,0xffff,gr7
312 test_spr_limmed 0xffff,0xffff,iacc0l ; 7fffffff*7fffffff+
313 test_spr_limmed 0x7fff,0xffff,iacc0h ; 40000000ffffffff
316 set_gr_limmed 0x7fff,0xffff,gr7 ; maximum overflow (pos)
317 set_gr_limmed 0x7fff,0xffff,gr8
318 set_spr_limmed 0xffff,0xffff,iacc0l
319 set_spr_limmed 0x7fff,0xffff,iacc0h
321 test_gr_limmed 0x7fff,0xffff,gr8
322 test_gr_limmed 0x7fff,0xffff,gr7
323 test_spr_limmed 0xffff,0xffff,iacc0l ; 7fffffff*7fffffff+
324 test_spr_limmed 0x7fff,0xffff,iacc0h ; 7fffffffffffffff
327 set_gr_limmed 0x7fff,0xffff,gr7 ; not quite overflow (neg)
328 set_gr_limmed 0x8000,0x0000,gr8
329 set_spr_limmed 0x8000,0x0000,iacc0l
330 set_spr_limmed 0xbfff,0xffff,iacc0h
332 test_gr_limmed 0x8000,0x0000,gr8
333 test_gr_limmed 0x7fff,0xffff,gr7
334 test_spr_limmed 0x0000,0x0000,iacc0l ; 7fffffff*7fffffff+
335 test_spr_limmed 0x8000,0x0000,iacc0h ; bfffffff80000000
338 set_gr_limmed 0x7fff,0xffff,gr7 ; just barely overflow (neg)
339 set_gr_limmed 0x8000,0x0000,gr8
340 set_spr_limmed 0x7fff,0xffff,iacc0l
341 set_spr_limmed 0xbfff,0xffff,iacc0h
343 test_gr_limmed 0x8000,0x0000,gr8
344 test_gr_limmed 0x7fff,0xffff,gr7
345 test_spr_limmed 0x0000,0x0000,iacc0l ; 7fffffff*7fffffff+
346 test_spr_limmed 0x8000,0x0000,iacc0h ; bfffffff7fffffff
349 set_gr_limmed 0x7fff,0xffff,gr7 ; maximum overflow (neg)
350 set_gr_limmed 0x8000,0x0000,gr8
351 set_spr_limmed 0x0000,0x0000,iacc0l
352 set_spr_limmed 0x8000,0x0000,iacc0h
354 test_gr_limmed 0x8000,0x0000,gr8
355 test_gr_limmed 0x7fff,0xffff,gr7
356 test_spr_limmed 0x0000,0x0000,iacc0l ; 7fffffff*7fffffff+
357 test_spr_limmed 0x8000,0x0000,iacc0h ; 8000000000000000