1 # RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases \
2 # RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s
3 # RUN: llvm-mc %s -triple=riscv32 \
4 # RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s
5 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
6 # RUN: | llvm-objdump -M no-aliases -d -r - \
7 # RUN: | FileCheck -check-prefixes=CHECK-OBJ-NOALIAS,CHECK-EXPAND,CHECK-INST %s
8 # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
9 # RUN: | llvm-objdump -d -r - \
10 # RUN: | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-ALIAS %s
12 # The following check prefixes are used in this test:
13 # CHECK-INST.....Match the canonical instr (tests alias to instr. mapping)
14 # CHECK-ALIAS....Match the alias (tests instr. to alias mapping)
15 # CHECK-EXPAND...Match canonical instr. unconditionally (tests alias expansion)
18 # CHECK-INST: addi a0, zero, 0
19 # CHECK-ALIAS: mv a0, zero
21 # CHECK-EXPAND: addi a0, zero, 1
23 # CHECK-EXPAND: addi a0, zero, -1
25 # CHECK-EXPAND: addi a0, zero, 2047
27 # CHECK-EXPAND: addi a0, zero, -2047
29 # CHECK-EXPAND: lui a1, 1
30 # CHECK-EXPAND: addi a1, a1, -2048
32 # CHECK-EXPAND: addi a1, zero, -2048
34 # CHECK-EXPAND: lui a1, 1
35 # CHECK-EXPAND: addi a1, a1, -2047
37 # CHECK-EXPAND: lui a1, 1048575
38 # CHECK-EXPAND: addi a1, a1, 2047
40 # CHECK-EXPAND: lui a1, 1
41 # CHECK-EXPAND: addi a1, a1, -1
43 # CHECK-EXPAND: lui a1, 1048575
44 # CHECK-EXPAND: addi a1, a1, 1
46 # CHECK-EXPAND: lui a2, 1
48 # CHECK-EXPAND: lui a2, 1048575
50 # CHECK-EXPAND: lui a2, 1
51 # CHECK-EXPAND: addi a2, a2, 1
53 # CHECK-EXPAND: lui a2, 1048575
54 # CHECK-EXPAND: addi a2, a2, -1
56 # CHECK-EXPAND: lui a2, 524288
57 # CHECK-EXPAND: addi a2, a2, -1
59 # CHECK-EXPAND: lui a2, 524288
60 # CHECK-EXPAND: addi a2, a2, 1
62 # CHECK-EXPAND: lui a2, 524288
64 # CHECK-EXPAND: lui a2, 524288
67 # CHECK-EXPAND: lui a2, 524288
69 # CHECK-EXPAND: addi a2, zero, -1
72 # CHECK-EXPAND: addi a0, zero, 1110
74 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
75 # CHECK-OBJ: R_RISCV_PCREL_LO12
76 li a0
, %pcrel_lo
(0x123456)
78 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
79 # CHECK-OBJ: R_RISCV_LO12
81 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
82 # CHECK-OBJ: R_RISCV_PCREL_LO12
86 # CHECK-EXPAND: lui a0, 291
87 # CHECK-EXPAND: addi a0, a0, 1110
89 # CHECK-EXPAND: lui a0, 291
90 # CHECK-EXPAND: addi a0, a0, 1111
94 # CHECK-EXPAND: lui a0, 1620
95 # CHECK-EXPAND: addi a0, a0, 801
98 # CHECK-INST: csrrs t4, instreth, zero
99 # CHECK-ALIAS: rdinstreth t4
101 # CHECK-INST: csrrs s11, cycleh, zero
102 # CHECK-ALIAS: rdcycleh s11
104 # CHECK-INST: csrrs t3, timeh, zero
105 # CHECK-ALIAS: rdtimeh t3
108 # CHECK-EXPAND: lb a0, 0(a1)
110 # CHECK-EXPAND: lh a0, 0(a1)
112 # CHECK-EXPAND: lw a0, 0(a1)
114 # CHECK-EXPAND: lbu a0, 0(a1)
116 # CHECK-EXPAND: lhu a0, 0(a1)
119 # CHECK-EXPAND: sb a0, 0(a1)
121 # CHECK-EXPAND: sh a0, 0(a1)
123 # CHECK-EXPAND: sw a0, 0(a1)