[LLD][COFF] Separate EC and native exports for ARM64X (#123652)
[llvm-project.git] / llvm / test / MC / CSKY / basic.s
blob3a8d3868f29577429a56bf623fceda98a4e609e6
1 # RUN: llvm-mc %s -triple=csky -show-encoding -csky-no-aliases -mattr=+e2 -mattr=+2e3 \
2 # RUN: -mattr=+mp1e2 | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3 # RUN: llvm-mc -filetype=obj -triple=csky -mattr=+e2 -mattr=+2e3 -mattr=+mp1e2 < %s \
4 # RUN: | llvm-objdump --mattr=+e2 --mattr=+2e3 --mattr=+mp1e2 -M no-aliases -M abi-names -d -r - \
5 # RUN: | FileCheck -check-prefixes=CHECK-ASM-AND-OBJ,CHECK-OBJ %s
7 # CHECK-ASM-AND-OBJ: addi32 a0, sp, 2
8 # CHECK-ASM: encoding: [0x0e,0xe4,0x01,0x00]
9 addi32 a0, sp, 2
11 # CHECK-ASM-AND-OBJ: subi32 a0, sp, 2
12 # CHECK-ASM: encoding: [0x0e,0xe4,0x01,0x10]
13 subi32 a0, sp, 2
15 # CHECK-ASM-AND-OBJ: andi32 a0, sp, 2
16 # CHECK-ASM: encoding: [0x0e,0xe4,0x02,0x20]
17 andi32 a0, sp, 2
19 # CHECK-ASM-AND-OBJ: andni32 a0, sp, 2
20 # CHECK-ASM: encoding: [0x0e,0xe4,0x02,0x30]
21 andni32 a0, sp, 2
23 # CHECK-ASM-AND-OBJ: xori32 a0, sp, 2
24 # CHECK-ASM: encoding: [0x0e,0xe4,0x02,0x40]
25 xori32 a0, sp, 2
27 # CHECK-ASM-AND-OBJ: lsli32 a0, sp, 2
28 # CHECK-ASM: encoding: [0x4e,0xc4,0x20,0x48]
29 lsli32 a0, sp, 2
31 # CHECK-ASM-AND-OBJ: lsri32 a0, sp, 2
32 # CHECK-ASM: encoding: [0x4e,0xc4,0x40,0x48]
33 lsri32 a0, sp, 2
35 # CHECK-ASM-AND-OBJ: asri32 a0, sp, 2
36 # CHECK-ASM: encoding: [0x4e,0xc4,0x80,0x48]
37 asri32 a0, sp, 2
39 # CHECK-ASM-AND-OBJ: ori32 a0, sp, 2
40 # CHECK-ASM: encoding: [0x0e,0xec,0x02,0x00]
41 ori32 a0, sp, 2
43 # CHECK-ASM-AND-OBJ: rotli32 a0, sp, 2
44 # CHECK-ASM: encoding: [0x4e,0xc4,0x00,0x49]
45 rotli32 a0, sp, 2
47 # CHECK-ASM-AND-OBJ: incf32 a0, sp, 2
48 # CHECK-ASM: encoding: [0x0e,0xc4,0x22,0x0c]
49 incf32 a0, sp, 2
51 # CHECK-ASM-AND-OBJ: inct32 a0, sp, 2
52 # CHECK-ASM: encoding: [0x0e,0xc4,0x42,0x0c]
53 inct32 a0, sp, 2
55 # CHECK-ASM-AND-OBJ: decf32 a0, sp, 2
56 # CHECK-ASM: encoding: [0x0e,0xc4,0x82,0x0c]
57 decf32 a0, sp, 2
59 # CHECK-ASM-AND-OBJ: dect32 a0, sp, 2
60 # CHECK-ASM: encoding: [0x0e,0xc4,0x02,0x0d]
61 dect32 a0, sp, 2
63 # CHECK-ASM-AND-OBJ: decgt32 a0, sp, 2
64 # CHECK-ASM: encoding: [0x4e,0xc4,0x20,0x10]
65 decgt32 a0, sp, 2
67 # CHECK-ASM-AND-OBJ: declt32 a0, sp, 2
68 # CHECK-ASM: encoding: [0x4e,0xc4,0x40,0x10]
69 declt32 a0, sp, 2
71 # CHECK-ASM-AND-OBJ: decne32 a0, sp, 2
72 # CHECK-ASM: encoding: [0x4e,0xc4,0x80,0x10]
73 decne32 a0, sp, 2
75 # CHECK-ASM-AND-OBJ: btsti32 a0, 2
76 # CHECK-ASM: encoding: [0x40,0xc4,0x80,0x28]
77 btsti32 a0, 2
79 # CHECK-ASM-AND-OBJ: bclri32 a0, sp, 2
80 # CHECK-ASM: encoding: [0x4e,0xc4,0x20,0x28]
81 bclri32 a0, sp, 2
83 # CHECK-ASM-AND-OBJ: bseti32 a0, sp, 2
84 # CHECK-ASM: encoding: [0x4e,0xc4,0x40,0x28]
85 bseti32 a0, sp, 2
87 # CHECK-ASM-AND-OBJ: cmpnei32 a0, 2
88 # CHECK-ASM: encoding: [0x40,0xeb,0x02,0x00]
89 cmpnei32 a0, 2
91 # CHECK-ASM-AND-OBJ: cmphsi32 a0, 2
92 # CHECK-ASM: encoding: [0x00,0xeb,0x01,0x00]
93 cmphsi32 a0, 2
95 # CHECK-ASM-AND-OBJ: cmplti32 a0, 2
96 # CHECK-ASM: encoding: [0x20,0xeb,0x01,0x00]
97 cmplti32 a0, 2
99 # CHECK-ASM-AND-OBJ: movi32 a0, 2
100 # CHECK-ASM: encoding: [0x00,0xea,0x02,0x00]
101 movi32 a0, 2
103 # CHECK-ASM-AND-OBJ: movih32 a0, 2
104 # CHECK-ASM: encoding: [0x20,0xea,0x02,0x00]
105 movih32 a0, 2
107 # CHECK-ASM-AND-OBJ: addu32 a3, l0, l1
108 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x00]
109 addu32 a3, l0, l1
111 # CHECK-ASM-AND-OBJ: subu32 a3, l0, l1
112 # CHECK-ASM: encoding: [0xa4,0xc4,0x83,0x00]
113 subu32 a3, l0, l1
115 # CHECK-ASM-AND-OBJ: and32 a3, l0, l1
116 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x20]
117 and32 a3, l0, l1
119 # CHECK-ASM-AND-OBJ: andn32 a3, l0, l1
120 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x20]
121 andn32 a3, l0, l1
123 # CHECK-ASM-AND-OBJ: or32 a3, l0, l1
124 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x24]
125 or32 a3, l0, l1
127 # CHECK-ASM-AND-OBJ: xor32 a3, l0, l1
128 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x24]
129 xor32 a3, l0, l1
131 # CHECK-ASM-AND-OBJ: nor32 a3, l0, l1
132 # CHECK-ASM: encoding: [0xa4,0xc4,0x83,0x24]
133 nor32 a3, l0, l1
135 # CHECK-ASM-AND-OBJ: lsl32 a3, l0, l1
136 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x40]
137 lsl32 a3, l0, l1
139 # CHECK-ASM-AND-OBJ: rotl32 a3, l0, l1
140 # CHECK-ASM: encoding: [0xa4,0xc4,0x03,0x41]
141 rotl32 a3, l0, l1
143 # CHECK-ASM-AND-OBJ: lsr32 a3, l0, l1
144 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x40]
145 lsr32 a3, l0, l1
147 # CHECK-ASM-AND-OBJ: asr32 a3, l0, l1
148 # CHECK-ASM: encoding: [0xa4,0xc4,0x83,0x40]
149 asr32 a3, l0, l1
151 # CHECK-ASM-AND-OBJ: lslc32 a0, sp, 2
152 # CHECK-ASM: encoding: [0x2e,0xc4,0x20,0x4c]
153 lslc32 a0, sp, 2
155 # CHECK-ASM-AND-OBJ: lsrc32 a0, sp, 2
156 # CHECK-ASM: encoding: [0x2e,0xc4,0x40,0x4c]
157 lsrc32 a0, sp, 2
159 # CHECK-ASM-AND-OBJ: asrc32 a0, sp, 2
160 # CHECK-ASM: encoding: [0x2e,0xc4,0x80,0x4c]
161 asrc32 a0, sp, 2
163 # CHECK-ASM-AND-OBJ: xsr32 a0, sp, 2
164 # CHECK-ASM: encoding: [0x2e,0xc4,0x00,0x4d]
165 xsr32 a0, sp, 2
167 # CHECK-ASM-AND-OBJ: bmaski32 a3, 17
168 # CHECK-ASM: encoding: [0x00,0xc6,0x23,0x50]
169 bmaski32 a3, 17
171 # CHECK-ASM-AND-OBJ: mult32 a3, l0, l1
172 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x84]
173 mult32 a3, l0, l1
175 # CHECK-ASM-AND-OBJ: divs32 a3, l0, l1
176 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x80]
177 divs32 a3, l0, l1
179 # CHECK-ASM-AND-OBJ: divu32 a3, l0, l1
180 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x80]
181 divu32 a3, l0, l1
183 # CHECK-ASM-AND-OBJ: ixh32 a3, l0, l1
184 # CHECK-ASM: encoding: [0xa4,0xc4,0x23,0x08]
185 ixh32 a3, l0, l1
187 # CHECK-ASM-AND-OBJ: ixw32 a3, l0, l1
188 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x08]
189 ixw32 a3, l0, l1
191 # CHECK-ASM-AND-OBJ: ixd32 a3, l0, l1
192 # CHECK-ASM: encoding: [0xa4,0xc4,0x83,0x08]
193 ixd32 a3, l0, l1
195 # CHECK-ASM-AND-OBJ: addc32 a3, l0, l1
196 # CHECK-ASM: encoding: [0xa4,0xc4,0x43,0x00]
197 addc32 a3, l0, l1
199 # CHECK-ASM-AND-OBJ: subc32 a3, l0, l1
200 # CHECK-ASM: encoding: [0xa4,0xc4,0x03,0x01]
201 subc32 a3, l0, l1
203 # CHECK-OBJ: ld32.b a0, (sp, 0x2)
204 # CHECK-ASM: ld32.b a0, (sp, 2)
205 # CHECK-ASM: encoding: [0x0e,0xd8,0x02,0x00]
206 ld32.b a0, (sp, 2)
208 # CHECK-OBJ: ld32.bs a0, (sp, 0x2)
209 # CHECK-ASM: ld32.bs a0, (sp, 2)
210 # CHECK-ASM: encoding: [0x0e,0xd8,0x02,0x40]
211 ld32.bs a0, (sp, 2)
213 # CHECK-OBJ: ld32.h a0, (sp, 0x2)
214 # CHECK-ASM: ld32.h a0, (sp, 2)
215 # CHECK-ASM: encoding: [0x0e,0xd8,0x01,0x10]
216 ld32.h a0, (sp, 2)
218 # CHECK-OBJ: ld32.hs a0, (sp, 0x2)
219 # CHECK-ASM: ld32.hs a0, (sp, 2)
220 # CHECK-ASM: encoding: [0x0e,0xd8,0x01,0x50]
221 ld32.hs a0, (sp, 2)
223 # CHECK-OBJ: ld32.w a0, (sp, 0x4)
224 # CHECK-ASM: ld32.w a0, (sp, 4)
225 # CHECK-ASM: encoding: [0x0e,0xd8,0x01,0x20]
226 ld32.w a0, (sp, 4)
228 # CHECK-ASM-AND-OBJ: ldr32.b a0, (sp, l1 << 2)
229 # CHECK-ASM: encoding: [0xae,0xd0,0x80,0x00]
230 ldr32.b a0, (sp, l1 << 2)
232 # CHECK-OBJ: ldex32.w a0, (sp, 0x4)
233 # CHECK-ASM: ldex32.w a0, (sp, 4)
234 # CHECK-ASM: encoding: [0x0e,0xd8,0x01,0x70]
235 ldex32.w a0, (sp, 4)
237 # CHECK-ASM-AND-OBJ: ldr32.bs a0, (sp, l1 << 2)
238 # CHECK-ASM: encoding: [0xae,0xd0,0x80,0x10]
239 ldr32.bs a0, (sp, l1 << 2)
241 # CHECK-ASM-AND-OBJ: ldr32.h a0, (sp, l1 << 3)
242 # CHECK-ASM: encoding: [0xae,0xd0,0x00,0x05]
243 ldr32.h a0, (sp, l1 << 3)
245 # CHECK-ASM-AND-OBJ: ldr32.hs a0, (sp, l1 << 3)
246 # CHECK-ASM: encoding: [0xae,0xd0,0x00,0x15]
247 ldr32.hs a0, (sp, l1 << 3)
249 # CHECK-ASM-AND-OBJ: ldr32.w a0, (sp, l1 << 3)
250 # CHECK-ASM: encoding: [0xae,0xd0,0x00,0x09]
251 ldr32.w a0, (sp, l1 << 3)
253 # CHECK-OBJ: st32.b a0, (sp, 0x2)
254 # CHECK-ASM: st32.b a0, (sp, 2)
255 # CHECK-ASM: encoding: [0x0e,0xdc,0x02,0x00]
256 st32.b a0, (sp, 2)
258 # CHECK-OBJ: st32.h a0, (sp, 0x2)
259 # CHECK-ASM: st32.h a0, (sp, 2)
260 # CHECK-ASM: encoding: [0x0e,0xdc,0x01,0x10]
261 st32.h a0, (sp, 2)
263 # CHECK-OBJ: st32.w a0, (sp, 0x4)
264 # CHECK-ASM: st32.w a0, (sp, 4)
265 # CHECK-ASM: encoding: [0x0e,0xdc,0x01,0x20]
266 st32.w a0, (sp, 4)
268 # CHECK-OBJ: stex32.w a0, (sp, 0x4)
269 # CHECK-ASM: stex32.w a0, (sp, 4)
270 # CHECK-ASM: encoding: [0x0e,0xdc,0x01,0x70]
271 stex32.w a0, (sp, 4)
273 # CHECK-ASM-AND-OBJ: str32.b a0, (sp, l1 << 2)
274 # CHECK-ASM: encoding: [0xae,0xd4,0x80,0x00]
275 str32.b a0, (sp, l1 << 2)
277 # CHECK-ASM-AND-OBJ: str32.h a0, (sp, l1 << 3)
278 # CHECK-ASM: encoding: [0xae,0xd4,0x00,0x05]
279 str32.h a0, (sp, l1 << 3)
281 # CHECK-ASM-AND-OBJ: str32.w a0, (sp, l1 << 3)
282 # CHECK-ASM: encoding: [0xae,0xd4,0x00,0x09]
283 str32.w a0, (sp, l1 << 3)
285 # CHECK-ASM-AND-OBJ: ldm32 a1-a2, (a0)
286 # CHECK-ASM: encoding: [0x20,0xd0,0x21,0x1c]
287 ldm32 a1-a2, (a0)
289 # CHECK-ASM-AND-OBJ: stm32 a1-a2, (a0)
290 # CHECK-ASM: encoding: [0x20,0xd4,0x21,0x1c]
291 stm32 a1-a2, (a0)
293 # CHECK-ASM-AND-OBJ: ldm32 l0-l3, (a0)
294 # CHECK-ASM: encoding: [0x80,0xd0,0x23,0x1c]
295 ldq32 r4-r7, (a0)
297 # CHECK-ASM-AND-OBJ: stm32 l0-l3, (a0)
298 # CHECK-ASM: encoding: [0x80,0xd4,0x23,0x1c]
299 stq32 r4-r7, (a0)
301 # CHECK-ASM-AND-OBJ: brev32 a3, l0
302 # CHECK-ASM: encoding: [0x04,0xc4,0x03,0x62]
303 brev32 a3, l0
305 # CHECK-ASM-AND-OBJ: abs32 a3, l0
306 # CHECK-ASM: encoding: [0x04,0xc4,0x03,0x02]
307 abs32 a3, l0
309 # CHECK-ASM-AND-OBJ: bgenr32 a3, l0
310 # CHECK-ASM: encoding: [0x04,0xc4,0x43,0x50]
311 bgenr32 a3, l0
313 # CHECK-ASM-AND-OBJ: revb32 a3, l0
314 # CHECK-ASM: encoding: [0x04,0xc4,0x83,0x60]
315 revb32 a3, l0
317 # CHECK-ASM-AND-OBJ: revh32 a3, l0
318 # CHECK-ASM: encoding: [0x04,0xc4,0x03,0x61]
319 revh32 a3, l0
321 # CHECK-ASM-AND-OBJ: ff0.32 a3, l0
322 # CHECK-ASM: encoding: [0x04,0xc4,0x23,0x7c]
323 ff0.32 a3, l0
325 # CHECK-ASM-AND-OBJ: ff1.32 a3, l0
326 # CHECK-ASM: encoding: [0x04,0xc4,0x43,0x7c]
327 ff1.32 a3, l0
329 # CHECK-ASM-AND-OBJ: xtrb0.32 a3, l0
330 # CHECK-ASM: encoding: [0x04,0xc4,0x23,0x70]
331 xtrb0.32 a3, l0
333 # CHECK-ASM-AND-OBJ: xtrb1.32 a3, l0
334 # CHECK-ASM: encoding: [0x04,0xc4,0x43,0x70]
335 xtrb1.32 a3, l0
337 # CHECK-ASM-AND-OBJ: xtrb2.32 a3, l0
338 # CHECK-ASM: encoding: [0x04,0xc4,0x83,0x70]
339 xtrb2.32 a3, l0
341 # CHECK-ASM-AND-OBJ: xtrb3.32 a3, l0
342 # CHECK-ASM: encoding: [0x04,0xc4,0x03,0x71]
343 xtrb3.32 a3, l0
345 # CHECK-ASM-AND-OBJ: mvc32 a3
346 # CHECK-ASM: encoding: [0x00,0xc4,0x03,0x05]
347 mvc32 a3
349 # CHECK-ASM-AND-OBJ: mvcv32 a3
350 # CHECK-ASM: encoding: [0x00,0xc4,0x03,0x06]
351 mvcv32 a3
353 # CHECK-ASM-AND-OBJ: cmpne32 a3, l0
354 # CHECK-ASM: encoding: [0x83,0xc4,0x80,0x04]
355 cmpne32 a3, l0
357 # CHECK-ASM-AND-OBJ: cmphs32 a3, l0
358 # CHECK-ASM: encoding: [0x83,0xc4,0x20,0x04]
359 cmphs32 a3, l0
361 # CHECK-ASM-AND-OBJ: cmplt32 a3, l0
362 # CHECK-ASM: encoding: [0x83,0xc4,0x40,0x04]
363 cmplt32 a3, l0
365 # CHECK-ASM-AND-OBJ: zext32 a3, l0, 7, 0
366 # CHECK-ASM: encoding: [0x04,0xc4,0xe3,0x54]
367 zext32 a3, l0, 7, 0
369 # CHECK-ASM-AND-OBJ: sext32 a3, l0, 7, 0
370 # CHECK-ASM: encoding: [0x04,0xc4,0xe3,0x58]
371 sext32 a3, l0, 7, 0
373 # CHECK-ASM-AND-OBJ: ldm32 l1-l3, (a0)
374 # CHECK-ASM: encoding: [0xa0,0xd0,0x22,0x1c]
375 ldm32 r5-r7, (a0)
377 # CHECK-ASM-AND-OBJ: stm32 l1-l3, (a0)
378 # CHECK-ASM: encoding: [0xa0,0xd4,0x22,0x1c]
379 stm32 r5-r7, (a0)
381 # CHECK-ASM-AND-OBJ: setc32
382 # CHECK-ASM: encoding: [0x00,0xc4,0x20,0x04]
383 setc32
385 # CHECK-ASM-AND-OBJ: clrc32
386 # CHECK-ASM: encoding: [0x00,0xc4,0x80,0x04]
387 clrc32
389 # CHECK-ASM-AND-OBJ: tst32 a3, l0
390 # CHECK-ASM: encoding: [0x83,0xc4,0x80,0x20]
391 tst32 a3, l0
393 # CHECK-ASM-AND-OBJ: tstnbz32 a3
394 # CHECK-ASM: encoding: [0x03,0xc4,0x00,0x21]
395 tstnbz32 a3
397 # CHECK-ASM-AND-OBJ: clrf32 a3
398 # CHECK-ASM: encoding: [0x60,0xc4,0x20,0x2c]
399 clrf32 a3
401 # CHECK-ASM-AND-OBJ: clrt32 a3
402 # CHECK-ASM: encoding: [0x60,0xc4,0x40,0x2c]
403 clrt32 a3
405 # CHECK-ASM-AND-OBJ: bar.brwarw
406 # CHECK-ASM: encoding: [0x00,0xc0,0x2f,0x84]
407 bar.brwarw
409 # CHECK-ASM-AND-OBJ: bar.brwarws
410 # CHECK-ASM: encoding: [0x00,0xc2,0x2f,0x84]
411 bar.brwarws
413 # CHECK-ASM-AND-OBJ: bar.brarw
414 # CHECK-ASM: encoding: [0x00,0xc0,0x27,0x84]
415 bar.brarw
417 # CHECK-ASM-AND-OBJ: bar.brarws
418 # CHECK-ASM: encoding: [0x00,0xc2,0x27,0x84]
419 bar.brarws
421 # CHECK-ASM-AND-OBJ: bar.brwaw
422 # CHECK-ASM: encoding: [0x00,0xc0,0x2e,0x84]
423 bar.brwaw
425 # CHECK-ASM-AND-OBJ: bar.brwaws
426 # CHECK-ASM: encoding: [0x00,0xc2,0x2e,0x84]
427 bar.brwaws
429 # CHECK-ASM-AND-OBJ: bar.brar
430 # CHECK-ASM: encoding: [0x00,0xc0,0x25,0x84]
431 bar.brar
433 # CHECK-ASM-AND-OBJ: bar.brars
434 # CHECK-ASM: encoding: [0x00,0xc2,0x25,0x84]
435 bar.brars
437 # CHECK-ASM-AND-OBJ: bar.bwaw
438 # CHECK-ASM: encoding: [0x00,0xc0,0x2a,0x84]
439 bar.bwaw
441 # CHECK-ASM-AND-OBJ: bar.bwaws
442 # CHECK-ASM: encoding: [0x00,0xc2,0x2a,0x84]
443 bar.bwaws
445 # CHECK-ASM-AND-OBJ: sync32
446 # CHECK-ASM: encoding: [0x00,0xc0,0x20,0x04]
447 sync32
449 # CHECK-ASM-AND-OBJ: sync32.s
450 # CHECK-ASM: encoding: [0x00,0xc2,0x20,0x04]
451 sync32.s
453 # CHECK-ASM-AND-OBJ: sync32.i
454 # CHECK-ASM: encoding: [0x20,0xc0,0x20,0x04]
455 sync32.i
457 # CHECK-ASM-AND-OBJ: sync32.is
458 # CHECK-ASM: encoding: [0x20,0xc2,0x20,0x04]
459 sync32.is
461 # CHECK-ASM-AND-OBJ: rfi32
462 # CHECK-ASM: encoding: [0x00,0xc0,0x20,0x44]
463 rfi32
465 # CHECK-ASM-AND-OBJ: stop32
466 # CHECK-ASM: encoding: [0x00,0xc0,0x20,0x48]
467 stop32
469 # CHECK-ASM-AND-OBJ: wait32
470 # CHECK-ASM: encoding: [0x00,0xc0,0x20,0x4c]
471 wait32
473 # CHECK-ASM-AND-OBJ: doze32
474 # CHECK-ASM: encoding: [0x00,0xc0,0x20,0x50]
475 doze32
477 # CHECK-ASM: br32 .L.test
478 # CHECK-ASM: encoding: [A,0xe8'A',A,A]
479 # CHECK-ASM: fixup A - offset: 0, value: .L.test, kind: fixup_csky_pcrel_imm16_scale2
480 .L.test:
481 br32 .L.test
483 # CHECK-ASM: bt32 .L.test2
484 # CHECK-ASM: encoding: [0x60'A',0xe8'A',A,A]
485 # CHECK-ASM: fixup A - offset: 0, value: .L.test2, kind: fixup_csky_pcrel_imm16_scale2
486 .L.test2:
487 bt32 .L.test2
489 # CHECK-ASM: bf32 .L.test3
490 # CHECK-ASM: encoding: [0x40'A',0xe8'A',A,A]
491 # CHECK-ASM: fixup A - offset: 0, value: .L.test3, kind: fixup_csky_pcrel_imm16_scale2
492 .L.test3:
493 bf32 .L.test3
495 # CHECK-ASM: bez32 a0, .L.test4
496 # CHECK-ASM: encoding: [A,0xe9'A',A,A]
497 # CHECK-ASM: fixup A - offset: 0, value: .L.test4, kind: fixup_csky_pcrel_imm16_scale2
498 .L.test4:
499 bez32 a0, .L.test4
501 # CHECK-ASM: bnez32 a0, .L.test5
502 # CHECK-ASM: encoding: [0x20'A',0xe9'A',A,A]
503 # CHECK-ASM: fixup A - offset: 0, value: .L.test5, kind: fixup_csky_pcrel_imm16_scale2
504 .L.test5:
505 bnez32 a0, .L.test5
507 # CHECK-ASM: bhz32 a0, .L.test6
508 # CHECK-ASM: encoding: [0x40'A',0xe9'A',A,A]
509 # CHECK-ASM: fixup A - offset: 0, value: .L.test6, kind: fixup_csky_pcrel_imm16_scale2
510 .L.test6:
511 bhz32 a0, .L.test6
513 # CHECK-ASM: blsz32 a0, .L.test7
514 # CHECK-ASM: encoding: [0x60'A',0xe9'A',A,A]
515 # CHECK-ASM: fixup A - offset: 0, value: .L.test7, kind: fixup_csky_pcrel_imm16_scale2
516 .L.test7:
517 blsz32 a0, .L.test7
519 # CHECK-ASM: blz32 a0, .L.test8
520 # CHECK-ASM: encoding: [0x80'A',0xe9'A',A,A]
521 # CHECK-ASM: fixup A - offset: 0, value: .L.test8, kind: fixup_csky_pcrel_imm16_scale2
522 .L.test8:
523 blz32 a0, .L.test8
525 # CHECK-ASM: bhsz32 a0, .L.test9
526 # CHECK-ASM: encoding: [0xa0'A',0xe9'A',A,A]
527 # CHECK-ASM: fixup A - offset: 0, value: .L.test9, kind: fixup_csky_pcrel_imm16_scale2
528 .L.test9:
529 bhsz32 a0, .L.test9
531 # CHECK-ASM: jmp32 a3
532 # CHECK-ASM: encoding: [0xc3,0xe8,0x00,0x00]
533 jmp32 a3
535 # CHECK-ASM: jmpi32 [.L.test10]
536 # CHECK-ASM: encoding: [0xc0'A',0xea'A',A,A]
537 # CHECK-ASM: fixup A - offset: 0, value: .L.test10, kind: fixup_csky_pcrel_uimm16_scale4
538 .L.test10:
539 jmpi32 [.L.test10]
541 # CHECK-ASM: bsr32 .L.test11
542 # CHECK-ASM: encoding: [A,0xe0'A',A,A]
543 # CHECK-ASM: fixup A - offset: 0, value: .L.test11, kind: fixup_csky_pcrel_imm26_scale2
544 .L.test11:
545 bsr32 .L.test11
547 # CHECK-ASM: jsr32 a3
548 # CHECK-ASM: encoding: [0xe3,0xe8,0x00,0x00]
549 jsr32 a3
551 # CHECK-ASM: jsri32 [.L.test12]
552 # CHECK-ASM: encoding: [0xe0'A',0xea'A',A,A]
553 # CHECK-ASM: fixup A - offset: 0, value: .L.test12, kind: fixup_csky_pcrel_uimm16_scale4
554 .L.test12:
555 jsri32 [.L.test12]
557 # CHECK-ASM: grs32 a0, .L.test13
558 # CHECK-ASM: encoding: [0x0c'A',0xcc'A',A,A]
559 # CHECK-ASM: fixup A - offset: 0, value: .L.test13, kind: fixup_csky_pcrel_imm18_scale2
560 .L.test13:
561 grs32 a0, .L.test13
563 # CHECK-ASM: lrw32 a0, [.L.test14]
564 # CHECK-ASM: encoding: [0x80'A',0xea'A',A,A]
565 # CHECK-ASM: fixup A - offset: 0, value: .L.test14, kind: fixup_csky_pcrel_uimm16_scale4
566 .L.test14:
567 lrw32 a0, [.L.test14]
569 # RUN: not llvm-mc -triple csky -mattr=+e2 -mattr=+2e3 --defsym=ERR=1 < %s 2>&1 | FileCheck %s
571 .ifdef ERR
573 # uimm12/oimm12/nimm12
574 addi32 a0, a0, 0 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [1, 4096]
575 subi32 a0, a0, 4097 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [1, 4096]
576 andi32 a0, a0, 4096 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [0, 4095]
577 andni32 a0, a0, 4096 # CHECK: :[[#@LINE]]:17: error: immediate must be an integer in the range [0, 4095]
578 xori32 a0, a0, 4096 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [0, 4095]
581 # uimm5
582 lsli32 a0, a0, 32 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [0, 31]
583 lsri32 a0, a0, 32 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [0, 31]
584 asri32 a0, a0, 32 # CHECK: :[[#@LINE]]:16: error: immediate must be an integer in the range [0, 31]
585 rotli32 a0, a0, 32 # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 31]
587 # uimm12(shift0)/uimm12_1/uimm12_2
588 ld32.b a0, (a0, -1) # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 4095]
589 ld32.h a0, (a0, 4095) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [0, 4094]
590 ld32.h a0, (a0, 4093) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [0, 4094]
591 ld32.w a0, (a0, 4093) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 4 bytes in the range [0, 4092]
592 ld32.w a0, (a0, 2) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 4 bytes in the range [0, 4092]
593 ldr32.b a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
594 ldr32.bs a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:25: error: immediate must be an integer in the range [0, 3]
595 ldr32.h a0, (a0, a1 << -1) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
596 ldr32.hs a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:25: error: immediate must be an integer in the range [0, 3]
597 ldr32.w a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
599 st32.b a0, (a0, -1) # CHECK: :[[@LINE]]:17: error: immediate must be an integer in the range [0, 4095]
600 st32.h a0, (a0, 4095) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [0, 4094]
601 st32.h a0, (a0, 4093) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 2 bytes in the range [0, 4094]
602 st32.w a0, (a0, 4093) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 4 bytes in the range [0, 4092]
603 st32.w a0, (a0, 2) # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 4 bytes in the range [0, 4092]
605 str32.b a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
606 str32.h a0, (a0, a1 << -1) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
607 str32.w a0, (a0, a1 << 4) # CHECK: :[[@LINE]]:24: error: immediate must be an integer in the range [0, 3]
609 # uimm16/oimm16
610 ori32 a0, a0, 0x10000 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 65535]
611 cmpnei32 a0, 0x10000 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 65535]
612 cmphsi32 a0, 0x10001 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [1, 65536]
613 cmplti32 a0, 0 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [1, 65536]
614 movi32 a0, 0x10000 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [0, 65535]
615 movih32 a0, 0x10000 # CHECK: :[[@LINE]]:13: error: immediate must be an integer in the range [0, 65535]
617 # Invalid mnemonics
618 subs t0, t2, t1 # CHECK: :[[#@LINE]]:1: error: unrecognized instruction mnemonic
619 nandi t0, t2, 0 # CHECK: :[[#@LINE]]:1: error: unrecognized instruction mnemonic
621 # Invalid register names
622 addi32 foo, sp, 10 # CHECK: :[[#@LINE]]:8: error: unknown operand
623 lsli32 a10, a2, 0x20 # CHECK: :[[#@LINE]]:8: error: unknown operand
624 asri32 x32, s0, s0 # CHECK: :[[#@LINE]]:8: error: unknown operand
626 # Invalid operand types
627 xori32 sp, 22, 220 # CHECK: :[[#@LINE]]:12: error: invalid operand for instruction
628 subu32 t0, t2, 1 # CHECK: :[[#@LINE]]:16: error: invalid operand for instruction
630 # Too many operands
631 subi32 t2, t3, 0x50, 0x60 # CHECK: :[[@LINE]]:22: error: invalid operand for instruction
633 # Too few operands
634 xori32 a0, a1 # CHECK: :[[#@LINE]]:1: error: too few operands for instruction
635 xor32 a0, a2 # CHECK: :[[#@LINE]]:1: error: too few operands for instruction
637 ldm32 a1-a33, (a1) # CHECK: :[[#@LINE]]:10: error: invalid register
638 stm32 a1-a33, (a1) # CHECK: :[[#@LINE]]:10: error: invalid register
640 ldq32 a1-a2, (a1) # CHECK: :[[#@LINE]]:1: error: Register sequence is not valid. 'r4-r7' expected
641 stq32 a1-a3, (a1) # CHECK: :[[#@LINE]]:1: error: Register sequence is not valid. 'r4-r7' expected
643 .endif