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)
17 # Needed for testing valid %pcrel_lo expressions
18 .Lpcrel_hi0: auipc a0, %pcrel_hi(foo)
20 # CHECK-INST: addi a0, zero, 0
21 # CHECK-ALIAS: mv a0, zero
23 # CHECK-EXPAND: addi a0, zero, 1
25 # CHECK-EXPAND: addi a0, zero, -1
27 # CHECK-EXPAND: addi a0, zero, 2047
29 # CHECK-EXPAND: addi a0, zero, -2047
31 # CHECK-EXPAND: lui a1, 1
32 # CHECK-EXPAND: addi a1, a1, -2048
34 # CHECK-EXPAND: addi a1, zero, -2048
36 # CHECK-EXPAND: lui a1, 1
37 # CHECK-EXPAND: addi a1, a1, -2047
39 # CHECK-EXPAND: lui a1, 1048575
40 # CHECK-EXPAND: addi a1, a1, 2047
42 # CHECK-EXPAND: lui a1, 1
43 # CHECK-EXPAND: addi a1, a1, -1
45 # CHECK-EXPAND: lui a1, 1048575
46 # CHECK-EXPAND: addi a1, a1, 1
48 # CHECK-EXPAND: lui a2, 1
50 # CHECK-EXPAND: lui a2, 1048575
52 # CHECK-EXPAND: lui a2, 1
53 # CHECK-EXPAND: addi a2, a2, 1
55 # CHECK-EXPAND: lui a2, 1048575
56 # CHECK-EXPAND: addi a2, a2, -1
58 # CHECK-EXPAND: lui a2, 524288
59 # CHECK-EXPAND: addi a2, a2, -1
61 # CHECK-EXPAND: lui a2, 524288
62 # CHECK-EXPAND: addi a2, a2, 1
64 # CHECK-EXPAND: lui a2, 524288
66 # CHECK-EXPAND: lui a2, 524288
69 # CHECK-EXPAND: lui a2, 524288
71 # CHECK-EXPAND: addi a2, zero, -1
74 # CHECK-EXPAND: addi a0, zero, 1110
77 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
78 # CHECK-OBJ: R_RISCV_LO12
80 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
81 # CHECK-OBJ: R_RISCV_PCREL_LO12
82 li a0
, %pcrel_lo
(.Lpcrel_hi0)
85 # CHECK-EXPAND: lui a0, 291
86 # CHECK-EXPAND: addi a0, a0, 1110
88 # CHECK-EXPAND: lui a0, 291
89 # CHECK-EXPAND: addi a0, a0, 1111
93 # CHECK-EXPAND: lui a0, 1620
94 # CHECK-EXPAND: addi a0, a0, 801
97 # CHECK-INST: csrrs t4, instreth, zero
98 # CHECK-ALIAS: rdinstreth t4
100 # CHECK-INST: csrrs s11, cycleh, zero
101 # CHECK-ALIAS: rdcycleh s11
103 # CHECK-INST: csrrs t3, timeh, zero
104 # CHECK-ALIAS: rdtimeh t3
107 # CHECK-EXPAND: lb a0, 0(a1)
109 # CHECK-EXPAND: lh a0, 0(a1)
111 # CHECK-EXPAND: lw a0, 0(a1)
113 # CHECK-EXPAND: lbu a0, 0(a1)
115 # CHECK-EXPAND: lhu a0, 0(a1)
118 # CHECK-EXPAND: sb a0, 0(a1)
120 # CHECK-EXPAND: sh a0, 0(a1)
122 # CHECK-EXPAND: sw a0, 0(a1)
125 # CHECK-EXPAND: slli a0, a1, 24
126 # CHECK-EXPAND: srai a0, a0, 24
129 # CHECK-EXPAND: slli a0, a1, 16
130 # CHECK-EXPAND: srai a0, a0, 16
133 # CHECK-INST: andi a0, a1, 255
134 # CHECK-ALIAS: andi a0, a1, 255
137 # CHECK-EXPAND: slli a0, a1, 16
138 # CHECK-EXPAND: srli a0, a0, 16