1 # RUN: llvm-mc %s -triple=riscv32 -mattr=+f,+c -riscv-no-aliases -show-encoding \
2 # RUN: | FileCheck -check-prefix=CHECK-ASM %s
3 # RUN: llvm-mc %s -triple riscv64 -mattr=+f,+c -riscv-no-aliases -show-encoding \
4 # RUN: | FileCheck -check-prefix=CHECK-ASM %s
5 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+f,+c < %s \
6 # RUN: | llvm-objdump --mattr=+f,+c -M no-aliases -d -r - \
7 # RUN: | FileCheck -check-prefix=CHECK-OBJ %s
8 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+f,+c < %s \
9 # RUN: | llvm-objdump --mattr=+f,+c -M no-aliases -d -r - \
10 # RUN: | FileCheck -check-prefix=CHECK-OBJ %s
14 # CHECK-ASM: .insn cr 2, 9, a0, a1
15 # CHECK-ASM: encoding: [0x2e,0x95]
16 # CHECK-OBJ: c.add a0, a1
19 # CHECK-ASM: .insn cr 2, 9, a0, a1
20 # CHECK-ASM: encoding: [0x2e,0x95]
21 # CHECK-OBJ: c.add a0, a1
22 .insn cr C2, 9, a0, a1
24 # CHECK-ASM: .insn ci 1, 0, a0, 13
25 # CHECK-ASM: encoding: [0x35,0x05]
26 # CHECK-OBJ: c.addi a0, 0xd
29 # CHECK-ASM: .insn ci 1, 0, a0, 13
30 # CHECK-ASM: encoding: [0x35,0x05]
31 # CHECK-OBJ: c.addi a0, 0xd
32 .insn ci C1, 0, a0, 13
34 # CHECK-ASM: .insn ci 1, 0, a6, 13
35 # CHECK-ASM: encoding: [0x35,0x08]
36 # CHECK-OBJ: c.addi a6, 0xd
39 # CHECK-ASM: .insn ci 1, 0, a6, 13
40 # CHECK-ASM: encoding: [0x35,0x08]
41 # CHECK-OBJ: c.addi a6, 0xd
42 .insn ci C1, 0, a6, 13
44 # CHECK-ASM: .insn ciw 0, 0, a0, 13
45 # CHECK-ASM: encoding: [0xa8,0x01]
46 # CHECK-OBJ: c.addi4spn a0, sp, 0xc8
47 .insn ciw 0, 0, a0, 13
49 # CHECK-ASM: .insn ciw 0, 0, a0, 13
50 # CHECK-ASM: encoding: [0xa8,0x01]
51 # CHECK-OBJ: c.addi4spn a0, sp, 0xc8
52 .insn ciw C0, 0, a0, 13
54 # CHECK-ASM: .insn css 2, 6, a0, 13
55 # CHECK-ASM: encoding: [0xaa,0xc6]
56 # CHECK-OBJ: c.swsp a0, 0x4c(sp)
57 .insn css 2, 6, a0, 13
59 # CHECK-ASM: .insn cl 0, 2, a0, 13
60 # CHECK-ASM: encoding: [0xa8,0x4d]
61 # CHECK-OBJ: c.lw a0, 0x58(a1)
62 .insn cl 0, 2, a0, 13(a1)
64 # CHECK-ASM: .insn cl 0, 2, a0, 0
65 # CHECK-ASM: encoding: [0x88,0x41]
66 # CHECK-OBJ: c.lw a0, 0x0(a1)
67 .insn cl 0, 2, a0, 0(a1)
69 # CHECK-ASM: .insn cs 0, 6, a0, 13
70 # CHECK-ASM: encoding: [0xa8,0xcd]
71 # CHECK-OBJ: c.sw a0, 0x58(a1)
72 .insn cs 0, 6, a0, 13(a1)
74 # CHECK-ASM: .insn cs 0, 6, a0, 0
75 # CHECK-ASM: encoding: [0x88,0xc1]
76 # CHECK-OBJ: c.sw a0, 0x0(a1)
77 .insn cs 0, 6, a0, (a1)
79 # CHECK-ASM: .insn ca 1, 35, 0, a0, a1
80 # CHECK-ASM: encoding: [0x0d,0x8d]
81 # CHECK-OBJ: c.sub a0, a1
82 .insn ca 1, 35, 0, a0, a1
84 # CHECK-ASM: .insn cb 1, 6, a0, target
85 # CHECK-ASM: encoding: [0x01'A',0xc1'A']
86 # CHECK-OBJ: c.beqz a0, 0x0 <target>
87 .insn cb 1, 6, a0, target
89 # CHECK-ASM: .insn cj 1, 5, target
90 # CHECK-ASM: encoding: [0bAAAAAA01,0b101AAAAA]
91 # CHECK-OBJ: c.j 0x0 <target>
94 # CHECK-ASM: .insn 0x2, 1
95 # CHECK-ASM: encoding: [0x01,0x00]
99 # CHECK-ASM: .insn 0x2, 1
100 # CHECK-ASM: encoding: [0x01,0x00]