1 # frv testcase for sdivi $GRi,$s12,$GRk
4 .include "../testutils.inc"
10 ; simple division 12 / 3
16 set_gr_limmed 0xfedc,0xba98,gr1
18 test_gr_limmed 0xffff,0xdb93,gr2
20 ; Random negative example
21 set_gr_limmed 0xfedc,0xba98,gr1
23 test_gr_immed 0x2468,gr2
25 ; Special case from the Arch Spec Vol 2
26 or_spr_immed 0x20,isr ; turn on isr.edem
27 set_gr_limmed 0x8000,0x0000,gr1
29 test_gr_limmed 0x7fff,0xffff,gr2
30 test_spr_bits 0x4,2,1,isr ; isr.aexc is set
32 and_spr_immed -33,isr ; turn off isr.edem
33 ; set up exception handler
35 and_spr_immed -4081,tbr ; clear tbr.tt
37 inc_gr_immed 0x170,gr17 ; address of exception handler
42 ; divide will cause overflow
44 set_gr_limmed 0x8000,0x0000,gr1
47 test_gr_limmed 0x8000,0x0000,gr2
51 e2: sdivi gr1,0,gr2 ; divide by zero
56 ok1: ; exception handler for overflow
57 test_spr_bits 0x18,3,0x2,isr ; isr.dtt is set
58 test_spr_bits 0x0001,0,0x1,esr0 ; esr0 is valid
59 test_spr_bits 0x003e,1,0x13,esr0 ; esr0.ec is set
64 ok2: ; exception handler for divide by zero
65 test_spr_bits 0x18,3,0x3,isr ; isr.dtt is set
66 test_spr_bits 0x0001,0,0x1,esr0 ; esr0 is valid
67 test_spr_bits 0x003e,1,0x13,esr0 ; esr0.ec is set