1 # RUN: llvm-mc %s -triple=riscv64 -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=riscv64 -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
8 # RUN: not llvm-mc -triple riscv64 \
9 # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \
10 # RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
11 # RUN: not llvm-mc -triple riscv32 -mattr=+c \
12 # RUN: -riscv-no-aliases -show-encoding < %s 2>&1 \
13 # RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
15 # FIXME: error messages for rv32c are misleading
17 # TODO: more exhaustive testing of immediate encoding.
19 # CHECK-ASM-AND-OBJ: c.ldsp ra, 0(sp)
20 # CHECK-ASM: encoding: [0x82,0x60]
21 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
23 # CHECK-ASM-AND-OBJ: c.sdsp ra, 504(sp)
24 # CHECK-ASM: encoding: [0x86,0xff]
25 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
27 # CHECK-ASM-AND-OBJ: c.ld a4, 0(a3)
28 # CHECK-ASM: encoding: [0x98,0x62]
29 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
31 # CHECK-ASM-AND-OBJ: c.sd a5, 248(a3)
32 # CHECK-ASM: encoding: [0xfc,0xfe]
33 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
36 # CHECK-ASM-AND-OBJ: c.subw a3, a4
37 # CHECK-ASM: encoding: [0x99,0x9e]
39 # CHECK-ASM-AND-OBJ: c.addw a0, a2
40 # CHECK-ASM: encoding: [0x31,0x9d]
41 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
44 # CHECK-ASM-AND-OBJ: c.addiw a3, -32
45 # CHECK-ASM: encoding: [0x81,0x36]
46 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
48 # CHECK-ASM-AND-OBJ: c.addiw a3, 31
49 # CHECK-ASM: encoding: [0xfd,0x26]
50 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
53 # CHECK-ASM-AND-OBJ: c.slli s0, 1
54 # CHECK-ASM: encoding: [0x06,0x04]
55 # CHECK-NO-EXT: error: instruction use requires an option to be enabled
57 # CHECK-ASM-AND-OBJ: c.srli a3, 63
58 # CHECK-ASM: encoding: [0xfd,0x92]
60 # CHECK-ASM-AND-OBJ: c.srai a2, 63
61 # CHECK-ASM: encoding: [0x7d,0x96]