forked from mortbopet/Ripes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandi.s
72 lines (57 loc) · 1.03 KB
/
andi.s
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.text
main:
#-------------------------------------------------------------
# Logical tests
#-------------------------------------------------------------
test_2:
li x1, 0xff00ff00
andi x30, x1, 0xffffff0f
li x29, 0xff00ff00
li gp, 2
bne x30, x29, fail
test_3:
li x1, 0x0ff00ff0
andi x30, x1, 0x0f0
li x29, 0x000000f0
li gp, 3
bne x30, x29, fail
test_4:
li x1, 0x00ff00ff
andi x30, x1, 0x70f
li x29, 0x0000000f
li gp, 4
bne x30, x29, fail
test_5:
li x1, 0xf00ff00f
andi x30, x1, 0x0f0
li x29, 0x00000000
li gp, 5
bne x30, x29, fail
#-------------------------------------------------------------
# Source/Destination tests
#-------------------------------------------------------------
test_6:
li x1, 0xff00ff00
andi x1, x1, 0x0f0
li x29, 0x00000000
li gp, 6
bne x1, x29, fail
test_13:
andi x1, x0, 0x0f0
li x29, 0
li gp, 13
bne x1, x29, fail
test_14:
li x1, 0x00ff00ff
andi x0, x1, 0x70f
li x29, 0
li gp, 14
bne x0, x29, fail
pass:
li a0, 42
li a7, 93
ecall
fail:
li a0, 0
li a7, 93
ecall