mips-jump-instructions.s
7.45 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
# RUN: FileCheck -check-prefix=CHECK32 %s
# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64r2 | \
# RUN: FileCheck -check-prefix=CHECK64 %s
# Check that the assembler can handle the documented syntax
# for jumps and branches.
#------------------------------------------------------------------------------
# Branch instructions
#------------------------------------------------------------------------------
# CHECK32: b 1332 # encoding: [0x4d,0x01,0x00,0x10]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bc1f 1332 # encoding: [0x4d,0x01,0x00,0x45]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bc1t 1332 # encoding: [0x4d,0x01,0x01,0x45]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: beq $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x11]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bgez $6, 1332 # encoding: [0x4d,0x01,0xc1,0x04]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bgezal $6, 1332 # encoding: [0x4d,0x01,0xd1,0x04]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bgtz $6, 1332 # encoding: [0x4d,0x01,0xc0,0x1c]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: blez $6, 1332 # encoding: [0x4d,0x01,0xc0,0x18]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bne $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x15]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bal 1332 # encoding: [0x4d,0x01,0x11,0x04]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: bnez $11, 1332 # encoding: [0x4d,0x01,0x60,0x15]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: beqz $11, 1332 # encoding: [0x4d,0x01,0x60,0x11]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: b 1332 # encoding: [0x4d,0x01,0x00,0x10]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bc1f 1332 # encoding: [0x4d,0x01,0x00,0x45]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bc1t 1332 # encoding: [0x4d,0x01,0x01,0x45]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: beq $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x11]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bgez $6, 1332 # encoding: [0x4d,0x01,0xc1,0x04]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bgezal $6, 1332 # encoding: [0x4d,0x01,0xd1,0x04]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bgtz $6, 1332 # encoding: [0x4d,0x01,0xc0,0x1c]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: blez $6, 1332 # encoding: [0x4d,0x01,0xc0,0x18]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bne $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x15]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bal 1332 # encoding: [0x4d,0x01,0x11,0x04]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: bnez $11, 1332 # encoding: [0x4d,0x01,0x60,0x15]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: beqz $11, 1332 # encoding: [0x4d,0x01,0x60,0x11]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
.set noreorder
b 1332
nop
bc1f 1332
nop
bc1t 1332
nop
beq $9,$6,1332
nop
bgez $6,1332
nop
bgezal $6,1332
nop
bgtz $6,1332
nop
blez $6,1332
nop
bne $9,$6,1332
nop
bal 1332
nop
bnez $11,1332
nop
beqz $11,1332
nop
end_of_code:
#------------------------------------------------------------------------------
# Jump instructions
#------------------------------------------------------------------------------
# CHECK32: j 1328 # encoding: [0x4c,0x01,0x00,0x08]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jal 1328 # encoding: [0x4c,0x01,0x00,0x0c]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalr $10, $11 # encoding: [0x09,0x50,0x60,0x01]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32:lab:
# CHECK32: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalr $4, $25 # encoding: [0x09,0x20,0x20,0x03]
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK32: jalx lab # encoding: [A,A,A,0b011101AA]
# CHECK32: # fixup A - offset: 0, value: lab, kind: fixup_Mips_26
# CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: j 1328 # encoding: [0x4c,0x01,0x00,0x08]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jal 1328 # encoding: [0x4c,0x01,0x00,0x0c]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalr $10, $11 # encoding: [0x09,0x50,0x60,0x01]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64:lab:
# CHECK64: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalr $4, $25 # encoding: [0x09,0x20,0x20,0x03]
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK64: jalx lab # encoding: [A,A,A,0b011101AA]
# CHECK64: # fixup A - offset: 0, value: lab, kind: fixup_Mips_26
# CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
j 1328
nop
jal 1328
nop
jalr $6
nop
jalr $31, $25
nop
jalr $10, $11
nop
jr $7
nop
lab:
j $7
nop
jal $25
nop
jal $4,$25
nop
jalx lab
nop