1# RUN: llvm-mc -triple riscv64 -mattr=+c -show-encoding < %s \
2# RUN:   | FileCheck -check-prefixes=CHECK-ALIAS %s
3# RUN: llvm-mc -triple riscv64 -mattr=+c -show-encoding \
4# RUN:   -riscv-no-aliases < %s | FileCheck -check-prefixes=CHECK-INST %s
5# RUN: llvm-mc -triple riscv64 -mattr=+c -filetype=obj < %s \
6# RUN:   | llvm-objdump  --triple=riscv64 --mattr=+c -d - \
7# RUN:   | FileCheck -check-prefixes=CHECK-BYTES,CHECK-ALIAS %s
8# RUN: llvm-mc -triple riscv64 -mattr=+c -filetype=obj < %s \
9# RUN:   | llvm-objdump  --triple=riscv64 --mattr=+c -d -M no-aliases - \
10# RUN:   | FileCheck -check-prefixes=CHECK-BYTES,CHECK-INST %s
11
12# Tests compressed instructions available in rv64 and not in rv32.
13
14# CHECK-BYTES: e0 7f
15# CHECK-ALIAS: ld s0, 248(a5)
16# CHECK-INST: c.ld s0, 248(a5)
17# CHECK: # encoding: [0xe0,0x7f]
18ld s0, 248(a5)
19
20# CHECK-BYTES: a0 e3
21# CHECK-ALIAS: sd s0, 64(a5)
22# CHECK-INST: c.sd s0, 64(a5)
23# CHECK: # encoding: [0xa0,0xe3]
24sd s0, 64(a5)
25
26# CHECK-BYTES: 7d 22
27# CHEACK-ALIAS: addiw tp, tp, 31
28# CHECK-INST: c.addiw  tp, 31
29# CHECK: # encoding: [0x7d,0x22]
30addiw tp, tp, 31
31
32# CHECK-BYTES: 1d 9c
33# CHEACK-ALIAS: subw s0, s0, a5
34# CHECK-INST: c.subw s0, a5
35# CHECK: # encoding:  [0x1d,0x9c]
36subw s0, s0, a5
37
38# CHECK-BYTES: 3d 9c
39# CHECK-ALIAS: addw s0, s0, a5
40# CHECK-INST: c.addw s0, a5
41# CHECK: # encoding: [0x3d,0x9c]
42addw s0, s0, a5
43
44# CHECK-BYTES: 3d 9c
45# CHECK-ALIAS: addw s0, s0, a5
46# CHECK-INST: c.addw s0, a5
47# CHECK: # encoding: [0x3d,0x9c]
48addw s0, a5, s0
49
50# CHECK-BYTES: ee 70
51# CHECK-ALIAS: ld ra, 248(sp)
52# CHECK-INST: c.ldsp ra, 248(sp)
53# CHECK: # encoding:  [0xee,0x70]
54ld ra, 248(sp)
55
56# CHECK-BYTES: a2 e0
57# CHECK-ALIAS: sd s0, 64(sp)
58# CHECK-INST: c.sdsp s0, 64(sp)
59# CHECK: # encoding: [0xa2,0xe0]
60sd s0, 64(sp)
61