1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# frv testcase for nudivi $GRi,$s12,$GRk
# mach: fr500 fr550 frv
.include "testutils.inc"
start
.global nudivi
nudivi:
set_spr_immed 0,gner0
set_spr_immed 0,gner1
; simple division 12 / 3
set_gr_immed 0x0000000c,gr3
nudivi gr3,3,gr3
test_gr_immed 0x00000004,gr3
test_spr_immed 0,gner0
test_spr_immed 0,gner1
; random example
set_gr_limmed 0xfedc,0xba98,gr3
nudivi gr3,0x7ff,gr3
test_gr_limmed 0x001f,0xdf93,gr3
test_spr_immed 0,gner0
test_spr_immed 0,gner1
; random example
set_gr_limmed 0xffff,0xffff,gr3
nudivi gr3,-2048,gr3
test_gr_immed 1,gr3
test_spr_immed 0,gner0
test_spr_immed 0,gner1
or_spr_immed 0x20,isr ; turn on isr.edem
nudivi gr1,0,gr32 ; divide by zero
test_spr_immed 1,gner0
test_spr_immed 0,gner1
and_spr_immed -33,isr ; turn off isr.edem
nudivi gr1,0,gr10 ; divide by zero
test_spr_immed 1,gner0
test_spr_immed 0x00000400,gner1
; simple division 12 / 3 -- should turn off ne flag
set_gr_immed 12,gr1
nudivi gr1,3,gr10
test_gr_immed 4,gr10
test_spr_immed 1,gner0
test_spr_immed 0,gner1
pass
|