1 # RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64r2 | FileCheck %s
3 # Check that signed negative 32-bit immediates are loaded correctly:
5 # CHECK: lui $10, 65519 # encoding: [0xef,0xff,0x0a,0x3c]
6 # CHECK: ori $10, $10, 61423 # encoding: [0xef,0xef,0x4a,0x35]
9 # Test bne with an immediate as the 2nd operand.
10 bne $2, 0x100010001, 1332
11 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
12 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
13 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
14 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
15 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
16 # CHECK: bne $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x14]
17 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
19 bne $2, 0x1000100010001, 1332
20 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
21 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
22 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
23 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
24 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
25 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
26 # CHECK: bne $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x14]
27 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
29 bne $2, -0x100010001, 1332
30 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
31 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
32 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
33 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
34 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
35 # CHECK: bne $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x14]
36 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
38 bne $2, -0x1000100010001, 1332
39 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
40 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
41 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
42 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
43 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
44 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
45 # CHECK: bne $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x14]
46 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
48 # Test beq with an immediate as the 2nd operand.
49 beq $2, 0x100010001, 1332
50 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
51 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
52 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
53 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
54 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
55 # CHECK: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10]
56 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
58 beq $2, 0x1000100010001, 1332
59 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
60 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
61 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
62 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
63 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
64 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
65 # CHECK: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10]
66 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
68 beq $2, -0x100010001, 1332
69 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
70 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
71 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
72 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
73 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
74 # CHECK: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10]
75 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
77 beq $2, -0x1000100010001, 1332
78 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
79 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
80 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
81 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
82 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
83 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
84 # CHECK: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10]
85 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
87 # Test ulhu with 64-bit immediate addresses.
89 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
90 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
91 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
92 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
93 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
94 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
95 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
96 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
98 ulhu $8, 0x1000100010001
99 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
100 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
101 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
102 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
103 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
104 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
105 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
106 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
107 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
108 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
110 ulhu $8, -0x100010001
111 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
112 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
113 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
114 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
115 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
116 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
117 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
118 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
119 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
121 ulhu $8, -0x1000100010001
122 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
123 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
124 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
125 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
126 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
127 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
128 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
129 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
130 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
131 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
133 # Test ulhu with source register and 64-bit immediate offset.
134 ulhu $8, 0x100010001($9)
135 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
136 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
137 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
138 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
139 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
140 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
141 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
142 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
143 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
145 ulhu $8, 0x1000100010001($9)
146 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
147 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
148 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
149 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
150 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
151 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
152 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
153 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
154 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
155 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
156 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
158 ulhu $8, -0x100010001($9)
159 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
160 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
161 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
162 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
163 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
164 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
165 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
166 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
167 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
169 ulhu $8, -0x1000100010001($9)
170 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
171 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
172 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
173 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
174 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
175 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
176 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
177 # CHECK: lbu $8, 1($1) # encoding: [0x01,0x00,0x28,0x90]
178 # CHECK: lbu $1, 0($1) # encoding: [0x00,0x00,0x21,0x90]
179 # CHECK: sll $8, $8, 8 # encoding: [0x00,0x42,0x08,0x00]
180 # CHECK: or $8, $8, $1 # encoding: [0x25,0x40,0x01,0x01]
182 # Test ulw with 64-bit immediate addresses.
184 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
185 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
186 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
187 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
188 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
189 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
191 ulw $8, 0x1000100010001
192 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
193 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
194 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
195 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
196 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
197 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
198 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
199 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
202 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
203 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
204 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
205 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
206 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
207 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
208 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
210 ulw $8, -0x1000100010001
211 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
212 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
213 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
214 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
215 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
216 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
217 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
218 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
220 # Test ulw with source register and 64-bit immediate offset.
221 ulw $8, 0x100010001($9)
222 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24]
223 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
224 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
225 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
226 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
227 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
228 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
230 ulw $8, 0x1000100010001($9)
231 # CHECK: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
232 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
233 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
234 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
235 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
236 # CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34]
237 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
238 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
239 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
241 ulw $8, -0x100010001($9)
242 # CHECK: addiu $1, $zero, -2 # encoding: [0xfe,0xff,0x01,0x24]
243 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
244 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
245 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
246 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
247 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
248 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
249 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]
251 ulw $8, -0x1000100010001($9)
252 # CHECK: lui $1, 65534 # encoding: [0xfe,0xff,0x01,0x3c]
253 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
254 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
255 # CHECK: ori $1, $1, 65534 # encoding: [0xfe,0xff,0x21,0x34]
256 # CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00]
257 # CHECK: ori $1, $1, 65535 # encoding: [0xff,0xff,0x21,0x34]
258 # CHECK: daddu $1, $1, $9 # encoding: [0x2d,0x08,0x29,0x00]
259 # CHECK: lwl $8, 3($1) # encoding: [0x03,0x00,0x28,0x88]
260 # CHECK: lwr $8, 0($1) # encoding: [0x00,0x00,0x28,0x98]