[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / test / MC / RISCV / rv32i-aliases-valid.s
blobd2e142efcfc51c8dd8d8ec31780052afd1e14d4c
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
20 li x10, 0
21 # CHECK-EXPAND: addi a0, zero, 1
22 li x10, 1
23 # CHECK-EXPAND: addi a0, zero, -1
24 li x10, -1
25 # CHECK-EXPAND: addi a0, zero, 2047
26 li x10, 2047
27 # CHECK-EXPAND: addi a0, zero, -2047
28 li x10, -2047
29 # CHECK-EXPAND: lui a1, 1
30 # CHECK-EXPAND: addi a1, a1, -2048
31 li x11, 2048
32 # CHECK-EXPAND: addi a1, zero, -2048
33 li x11, -2048
34 # CHECK-EXPAND: lui a1, 1
35 # CHECK-EXPAND: addi a1, a1, -2047
36 li x11, 2049
37 # CHECK-EXPAND: lui a1, 1048575
38 # CHECK-EXPAND: addi a1, a1, 2047
39 li x11, -2049
40 # CHECK-EXPAND: lui a1, 1
41 # CHECK-EXPAND: addi a1, a1, -1
42 li x11, 4095
43 # CHECK-EXPAND: lui a1, 1048575
44 # CHECK-EXPAND: addi a1, a1, 1
45 li x11, -4095
46 # CHECK-EXPAND: lui a2, 1
47 li x12, 4096
48 # CHECK-EXPAND: lui a2, 1048575
49 li x12, -4096
50 # CHECK-EXPAND: lui a2, 1
51 # CHECK-EXPAND: addi a2, a2, 1
52 li x12, 4097
53 # CHECK-EXPAND: lui a2, 1048575
54 # CHECK-EXPAND: addi a2, a2, -1
55 li x12, -4097
56 # CHECK-EXPAND: lui a2, 524288
57 # CHECK-EXPAND: addi a2, a2, -1
58 li x12, 2147483647
59 # CHECK-EXPAND: lui a2, 524288
60 # CHECK-EXPAND: addi a2, a2, 1
61 li x12, -2147483647
62 # CHECK-EXPAND: lui a2, 524288
63 li x12, -2147483648
64 # CHECK-EXPAND: lui a2, 524288
65 li x12, -0x80000000
67 # CHECK-EXPAND: lui a2, 524288
68 li x12, 0x80000000
69 # CHECK-EXPAND: addi a2, zero, -1
70 li x12, 0xFFFFFFFF
72 # CHECK-EXPAND: addi a0, zero, 1110
73 li a0, %lo(0x123456)
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
80 li a0, %lo(foo)
81 # CHECK-OBJ-NOALIAS: addi a0, zero, 0
82 # CHECK-OBJ: R_RISCV_PCREL_LO12
83 li a0, %pcrel_lo(foo)
85 .equ CONST, 0x123456
86 # CHECK-EXPAND: lui a0, 291
87 # CHECK-EXPAND: addi a0, a0, 1110
88 li a0, CONST
89 # CHECK-EXPAND: lui a0, 291
90 # CHECK-EXPAND: addi a0, a0, 1111
91 li a0, CONST+1
93 .equ CONST, 0x654321
94 # CHECK-EXPAND: lui a0, 1620
95 # CHECK-EXPAND: addi a0, a0, 801
96 li a0, CONST
98 # CHECK-INST: csrrs t4, instreth, zero
99 # CHECK-ALIAS: rdinstreth t4
100 rdinstreth x29
101 # CHECK-INST: csrrs s11, cycleh, zero
102 # CHECK-ALIAS: rdcycleh s11
103 rdcycleh x27
104 # CHECK-INST: csrrs t3, timeh, zero
105 # CHECK-ALIAS: rdtimeh t3
106 rdtimeh x28
108 # CHECK-EXPAND: lb a0, 0(a1)
109 lb x10, (x11)
110 # CHECK-EXPAND: lh a0, 0(a1)
111 lh x10, (x11)
112 # CHECK-EXPAND: lw a0, 0(a1)
113 lw x10, (x11)
114 # CHECK-EXPAND: lbu a0, 0(a1)
115 lbu x10, (x11)
116 # CHECK-EXPAND: lhu a0, 0(a1)
117 lhu x10, (x11)
119 # CHECK-EXPAND: sb a0, 0(a1)
120 sb x10, (x11)
121 # CHECK-EXPAND: sh a0, 0(a1)
122 sh x10, (x11)
123 # CHECK-EXPAND: sw a0, 0(a1)
124 sw x10, (x11)