• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 %s -triple riscv64 -mattr=+c -riscv-no-aliases -show-encoding \
4# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
5# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \
6# RUN:     | llvm-objdump -M no-aliases -d -r - \
7# RUN:     | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
8# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c < %s \
9# RUN:     | llvm-objdump -M no-aliases -d -r - \
10# RUN:     | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s
11
12# CHECK-ASM-AND-OBJ: c.nop 8
13# CHECK-ASM: encoding: [0x21,0x00]
14c.nop 8
15
16# CHECK-ASM: c.addi zero, 7
17# CHECK-ASM: encoding: [0x1d,0x00]
18# CHECK-OBJ: c.nop 7
19c.addi x0, 7
20
21# CHECK-ASM-AND-OBJ: c.addi a0, 0
22# CHECK-ASM: encoding: [0x01,0x05]
23c.addi a0, 0
24
25# CHECK-ASM-AND-OBJ: c.li zero, 0
26# CHECK-ASM: encoding: [0x01,0x40]
27c.li x0, 0
28
29# CHECK-ASM-AND-OBJ: c.li zero, 1
30# CHECK-ASM: encoding: [0x05,0x40]
31c.li x0, 1
32
33# CHECK-ASM-AND-OBJ: c.lui zero, 1
34# CHECK-ASM: encoding: [0x05,0x60]
35c.lui x0, 1
36
37# CHECK-ASM-AND-OBJ: c.mv zero, a0
38# CHECK-ASM: encoding: [0x2a,0x80]
39c.mv x0, a0
40
41# CHECK-ASM-AND-OBJ: c.add zero, a0
42# CHECK-ASM: encoding: [0x2a,0x90]
43c.add x0, a0
44
45# CHECK-ASM-AND-OBJ: c.slli zero, 1
46# CHECK-ASM: encoding: [0x06,0x00]
47c.slli x0, 1
48
49# CHECK-ASM-AND-OBJ: c.slli64 zero
50# CHECK-ASM: encoding: [0x02,0x00]
51c.slli64 x0
52
53# CHECK-ASM-AND-OBJ: c.slli64 a0
54# CHECK-ASM: encoding: [0x02,0x05]
55c.slli64 a0
56
57# CHECK-ASM-AND-OBJ: c.srli64 a1
58# CHECK-ASM: encoding: [0x81,0x81]
59c.srli64 a1
60
61# CHECK-ASM-AND-OBJ: c.srai64 a0
62# CHECK-ASM: encoding: [0x01,0x85]
63c.srai64 a0
64