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
| # RUN: llvm-mc %s -triple=riscv32 -mattr=+c -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
# RUN: llvm-mc %s -triple riscv64 -mattr=+c -riscv-no-aliases -show-encoding \
# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \
# RUN: | llvm-objdump -M no-aliases -d -r - \
# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c < %s \
# RUN: | llvm-objdump -M no-aliases -d -r - \
# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
# CHECK-ASM-AND-OBJ: c.nop 8
# CHECK-ASM: encoding: [0x21,0x00]
c.nop 8
# CHECK-ASM: c.addi zero, 7
# CHECK-ASM: encoding: [0x1d,0x00]
# CHECK-OBJ: c.nop 7
c.addi x0, 7
# CHECK-ASM-AND-OBJ: c.addi a0, 0
# CHECK-ASM: encoding: [0x01,0x05]
c.addi a0, 0
# CHECK-ASM-AND-OBJ: c.li zero, 0
# CHECK-ASM: encoding: [0x01,0x40]
c.li x0, 0
# CHECK-ASM-AND-OBJ: c.li zero, 1
# CHECK-ASM: encoding: [0x05,0x40]
c.li x0, 1
# CHECK-ASM-AND-OBJ: c.lui zero, 1
# CHECK-ASM: encoding: [0x05,0x60]
c.lui x0, 1
# CHECK-ASM-AND-OBJ: c.mv zero, a0
# CHECK-ASM: encoding: [0x2a,0x80]
c.mv x0, a0
# CHECK-ASM-AND-OBJ: c.add zero, a0
# CHECK-ASM: encoding: [0x2a,0x90]
c.add x0, a0
# CHECK-ASM-AND-OBJ: c.slli zero, 1
# CHECK-ASM: encoding: [0x06,0x00]
c.slli x0, 1
# CHECK-ASM-AND-OBJ: c.slli64 zero
# CHECK-ASM: encoding: [0x02,0x00]
c.slli64 x0
# CHECK-ASM-AND-OBJ: c.slli64 a0
# CHECK-ASM: encoding: [0x02,0x05]
c.slli64 a0
# CHECK-ASM-AND-OBJ: c.srli64 a1
# CHECK-ASM: encoding: [0x81,0x81]
c.srli64 a1
# CHECK-ASM-AND-OBJ: c.srai64 a0
# CHECK-ASM: encoding: [0x01,0x85]
c.srai64 a0
|