[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / RISCV / rv32c-valid.s
bloba13e0d279437be9eba41cf604e820822a3b861a3
1 # RUN: llvm-mc %s -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding \
2 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \
4 # RUN: | llvm-objdump -mattr=+c -M no-aliases -d -r - \
5 # RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
6 # RUN: llvm-mc %s -triple=riscv64 -mattr=+c -riscv-no-aliases -show-encoding \
7 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
8 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c < %s \
9 # RUN: | llvm-objdump -mattr=+c -M no-aliases -d -r - \
10 # RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
12 # TODO: more exhaustive testing of immediate encoding.
14 # CHECK-ASM-AND-OBJ: c.lwsp ra, 0(sp)
15 # CHECK-ASM: encoding: [0x82,0x40]
16 c.lwsp ra, 0(sp)
17 # CHECK-ASM-AND-OBJ: c.swsp ra, 252(sp)
18 # CHECK-ASM: encoding: [0x86,0xdf]
19 c.swsp ra, 252(sp)
20 # CHECK-ASM-AND-OBJ: c.lw a2, 0(a0)
21 # CHECK-ASM: encoding: [0x10,0x41]
22 c.lw a2, 0(a0)
23 # CHECK-ASM-AND-OBJ: c.sw a5, 124(a3)
24 # CHECK-ASM: encoding: [0xfc,0xde]
25 c.sw a5, 124(a3)
27 # CHECK-ASM-AND-OBJ: c.j -2048
28 # CHECK-ASM: encoding: [0x01,0xb0]
29 c.j -2048
30 # CHECK-ASM-AND-OBJ: c.jr a7
31 # CHECK-ASM: encoding: [0x82,0x88]
32 c.jr a7
33 # CHECK-ASM-AND-OBJ: c.jalr a1
34 # CHECK-ASM: encoding: [0x82,0x95]
35 c.jalr a1
36 # CHECK-ASM-AND-OBJ: c.beqz a3, -256
37 # CHECK-ASM: encoding: [0x81,0xd2]
38 c.beqz a3, -256
39 # CHECK-ASM-AND-OBJ: c.bnez a5, 254
40 # CHECK-ASM: encoding: [0xfd,0xef]
41 c.bnez a5, 254
43 # CHECK-ASM-AND-OBJ: c.li a7, 31
44 # CHECK-ASM: encoding: [0xfd,0x48]
45 c.li a7, 31
46 # CHECK-ASM-AND-OBJ: c.addi a3, -32
47 # CHECK-ASM: encoding: [0x81,0x16]
48 c.addi a3, -32
49 # CHECK-ASM-AND-OBJ: c.addi16sp sp, -512
50 # CHECK-ASM: encoding: [0x01,0x71]
51 c.addi16sp sp, -512
52 # CHECK-ASM-AND-OBJ: c.addi16sp sp, 496
53 # CHECK-ASM: encoding: [0x7d,0x61]
54 c.addi16sp sp, 496
55 # CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 1020
56 # CHECK-ASM: encoding: [0xf4,0x1f]
57 c.addi4spn a3, sp, 1020
58 # CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 4
59 # CHECK-ASM: encoding: [0x54,0x00]
60 c.addi4spn a3, sp, 4
61 # CHECK-ASM-AND-OBJ: c.slli a1, 1
62 # CHECK-ASM: encoding: [0x86,0x05]
63 c.slli a1, 1
64 # CHECK-ASM-AND-OBJ: c.srli a3, 31
65 # CHECK-ASM: encoding: [0xfd,0x82]
66 c.srli a3, 31
67 # CHECK-ASM-AND-OBJ: c.srai a4, 2
68 # CHECK-ASM: encoding: [0x09,0x87]
69 c.srai a4, 2
70 # CHECK-ASM-AND-OBJ: c.andi a5, 15
71 # CHECK-ASM: encoding: [0xbd,0x8b]
72 c.andi a5, 15
73 # CHECK-ASM-AND-OBJ: c.mv a7, s0
74 # CHECK-ASM: encoding: [0xa2,0x88]
75 c.mv a7, s0
76 # CHECK-ASM-AND-OBJ: c.and a1, a2
77 # CHECK-ASM: encoding: [0xf1,0x8d]
78 c.and a1, a2
79 # CHECK-ASM-AND-OBJ: c.or a2, a3
80 # CHECK-ASM: encoding: [0x55,0x8e]
81 c.or a2, a3
82 # CHECK-ASM-AND-OBJ: c.xor a3, a4
83 # CHECK-ASM: encoding: [0xb9,0x8e]
84 c.xor a3, a4
85 # CHECK-ASM-AND-OBJ: c.sub a4, a5
86 # CHECK-ASM: encoding: [0x1d,0x8f]
87 c.sub a4, a5
88 # CHECK-ASM-AND-OBJ: c.nop
89 # CHECK-ASM: encoding: [0x01,0x00]
90 c.nop
91 # CHECK-ASM-AND-OBJ: c.ebreak
92 # CHECK-ASM: encoding: [0x02,0x90]
93 c.ebreak
94 # CHECK-ASM-AND-OBJ: c.lui s0, 1
95 # CHECK-ASM: encoding: [0x05,0x64]
96 c.lui s0, 1
97 # CHECK-ASM-AND-OBJ: c.lui s0, 31
98 # CHECK-ASM: encoding: [0x7d,0x64]
99 c.lui s0, 31
100 # CHECK-ASM-AND-OBJ: c.lui s0, 1048544
101 # CHECK-ASM: encoding: [0x01,0x74]
102 c.lui s0, 0xfffe0
103 # CHECK-ASM-AND-OBJ: c.lui s0, 1048575
104 # CHECK-ASM: encoding: [0x7d,0x74]
105 c.lui s0, 0xfffff
106 # CHECK-ASM-AND-OBJ: c.unimp
107 # CHECK-ASM: encoding: [0x00,0x00]
108 c.unimp