[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / test / MC / RISCV / rvi-pseudos.s
blob37501a00e3ea544358d07d69fa2cea97373a5d8b
1 # RUN: llvm-mc %s -triple=riscv32 \
2 # RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NOPIC,CHECK-RV32
3 # RUN: llvm-mc %s -triple=riscv64 \
4 # RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NOPIC,CHECK-RV64
5 # RUN: llvm-mc %s -triple=riscv32 -position-independent \
6 # RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PIC,CHECK-RV32,CHECK-PIC-RV32
7 # RUN: llvm-mc %s -triple=riscv64 -position-independent \
8 # RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PIC,CHECK-RV64,CHECK-PIC-RV64
10 # CHECK: .Lpcrel_hi0:
11 # CHECK: auipc a0, %pcrel_hi(a_symbol)
12 # CHECK: addi a0, a0, %pcrel_lo(.Lpcrel_hi0)
13 lla a0, a_symbol
15 # CHECK: .Lpcrel_hi1:
16 # CHECK: auipc a1, %pcrel_hi(another_symbol)
17 # CHECK: addi a1, a1, %pcrel_lo(.Lpcrel_hi1)
18 lla a1, another_symbol
20 # Check that we can load the address of symbols that are spelled like a register
21 # CHECK: .Lpcrel_hi2:
22 # CHECK: auipc a2, %pcrel_hi(zero)
23 # CHECK: addi a2, a2, %pcrel_lo(.Lpcrel_hi2)
24 lla a2, zero
26 # CHECK: .Lpcrel_hi3:
27 # CHECK: auipc a3, %pcrel_hi(ra)
28 # CHECK: addi a3, a3, %pcrel_lo(.Lpcrel_hi3)
29 lla a3, ra
31 # CHECK: .Lpcrel_hi4:
32 # CHECK: auipc a4, %pcrel_hi(f1)
33 # CHECK: addi a4, a4, %pcrel_lo(.Lpcrel_hi4)
34 lla a4, f1
36 # CHECK: .Lpcrel_hi5:
37 # CHECK: auipc a5, %pcrel_hi(a_symbol+2040)
38 # CHECK: addi a5, a5, %pcrel_lo(.Lpcrel_hi5)
39 lla a5, a_symbol + (0xFF << 3)
41 # CHECK: .Lpcrel_hi6:
42 # CHECK-NOPIC: auipc a0, %pcrel_hi(a_symbol)
43 # CHECK-NOPIC: addi a0, a0, %pcrel_lo(.Lpcrel_hi6)
44 # CHECK-PIC: auipc a0, %got_pcrel_hi(a_symbol)
45 # CHECK-PIC-RV32: lw a0, %pcrel_lo(.Lpcrel_hi6)(a0)
46 # CHECK-PIC-RV64: ld a0, %pcrel_lo(.Lpcrel_hi6)(a0)
47 la a0, a_symbol
49 # CHECK: .Lpcrel_hi7:
50 # CHECK-NOPIC: auipc a1, %pcrel_hi(another_symbol)
51 # CHECK-NOPIC: addi a1, a1, %pcrel_lo(.Lpcrel_hi7)
52 # CHECK-PIC: auipc a1, %got_pcrel_hi(another_symbol)
53 # CHECK-PIC-RV32: lw a1, %pcrel_lo(.Lpcrel_hi7)(a1)
54 # CHECK-PIC-RV64: ld a1, %pcrel_lo(.Lpcrel_hi7)(a1)
55 la a1, another_symbol
57 # Check that we can load the address of symbols that are spelled like a register
58 # CHECK: .Lpcrel_hi8:
59 # CHECK-NOPIC: auipc a2, %pcrel_hi(zero)
60 # CHECK-NOPIC: addi a2, a2, %pcrel_lo(.Lpcrel_hi8)
61 # CHECK-PIC: auipc a2, %got_pcrel_hi(zero)
62 # CHECK-PIC-RV32: lw a2, %pcrel_lo(.Lpcrel_hi8)(a2)
63 # CHECK-PIC-RV64: ld a2, %pcrel_lo(.Lpcrel_hi8)(a2)
64 la a2, zero
66 # CHECK: .Lpcrel_hi9:
67 # CHECK-NOPIC: auipc a3, %pcrel_hi(ra)
68 # CHECK-NOPIC: addi a3, a3, %pcrel_lo(.Lpcrel_hi9)
69 # CHECK-PIC: auipc a3, %got_pcrel_hi(ra)
70 # CHECK-PIC-RV32: lw a3, %pcrel_lo(.Lpcrel_hi9)(a3)
71 # CHECK-PIC-RV64: ld a3, %pcrel_lo(.Lpcrel_hi9)(a3)
72 la a3, ra
74 # CHECK: .Lpcrel_hi10:
75 # CHECK-NOPIC: auipc a4, %pcrel_hi(f1)
76 # CHECK-NOPIC: addi a4, a4, %pcrel_lo(.Lpcrel_hi10)
77 # CHECK-PIC: auipc a4, %got_pcrel_hi(f1)
78 # CHECK-PIC-RV32: lw a4, %pcrel_lo(.Lpcrel_hi10)(a4)
79 # CHECK-PIC-RV64: ld a4, %pcrel_lo(.Lpcrel_hi10)(a4)
80 la a4, f1
82 # CHECK: .Lpcrel_hi11:
83 # CHECK: auipc a0, %tls_ie_pcrel_hi(a_symbol)
84 # CHECK-RV32: lw a0, %pcrel_lo(.Lpcrel_hi11)(a0)
85 # CHECK-RV64: ld a0, %pcrel_lo(.Lpcrel_hi11)(a0)
86 la.tls.ie a0, a_symbol
88 # CHECK: .Lpcrel_hi12:
89 # CHECK: auipc a1, %tls_ie_pcrel_hi(another_symbol)
90 # CHECK-RV32: lw a1, %pcrel_lo(.Lpcrel_hi12)(a1)
91 # CHECK-RV64: ld a1, %pcrel_lo(.Lpcrel_hi12)(a1)
92 la.tls.ie a1, another_symbol
94 # Check that we can load the address of symbols that are spelled like a register
95 # CHECK: .Lpcrel_hi13:
96 # CHECK: auipc a2, %tls_ie_pcrel_hi(zero)
97 # CHECK-RV32: lw a2, %pcrel_lo(.Lpcrel_hi13)(a2)
98 # CHECK-RV64: ld a2, %pcrel_lo(.Lpcrel_hi13)(a2)
99 la.tls.ie a2, zero
101 # CHECK: .Lpcrel_hi14:
102 # CHECK: auipc a3, %tls_ie_pcrel_hi(ra)
103 # CHECK-RV32: lw a3, %pcrel_lo(.Lpcrel_hi14)(a3)
104 # CHECK-RV64: ld a3, %pcrel_lo(.Lpcrel_hi14)(a3)
105 la.tls.ie a3, ra
107 # CHECK: .Lpcrel_hi15:
108 # CHECK: auipc a4, %tls_ie_pcrel_hi(f1)
109 # CHECK-RV32: lw a4, %pcrel_lo(.Lpcrel_hi15)(a4)
110 # CHECK-RV64: ld a4, %pcrel_lo(.Lpcrel_hi15)(a4)
111 la.tls.ie a4, f1
113 # CHECK: .Lpcrel_hi16:
114 # CHECK: auipc a0, %tls_gd_pcrel_hi(a_symbol)
115 # CHECK: addi a0, a0, %pcrel_lo(.Lpcrel_hi16)
116 la.tls.gd a0, a_symbol
118 # CHECK: .Lpcrel_hi17:
119 # CHECK: auipc a1, %tls_gd_pcrel_hi(another_symbol)
120 # CHECK: addi a1, a1, %pcrel_lo(.Lpcrel_hi17)
121 la.tls.gd a1, another_symbol
123 # Check that we can load the address of symbols that are spelled like a register
124 # CHECK: .Lpcrel_hi18:
125 # CHECK: auipc a2, %tls_gd_pcrel_hi(zero)
126 # CHECK: addi a2, a2, %pcrel_lo(.Lpcrel_hi18)
127 la.tls.gd a2, zero
129 # CHECK: .Lpcrel_hi19:
130 # CHECK: auipc a3, %tls_gd_pcrel_hi(ra)
131 # CHECK: addi a3, a3, %pcrel_lo(.Lpcrel_hi19)
132 la.tls.gd a3, ra
134 # CHECK: .Lpcrel_hi20:
135 # CHECK: auipc a4, %tls_gd_pcrel_hi(f1)
136 # CHECK: addi a4, a4, %pcrel_lo(.Lpcrel_hi20)
137 la.tls.gd a4, f1
139 # CHECK: .Lpcrel_hi21:
140 # CHECK: auipc a0, %pcrel_hi(a_symbol)
141 # CHECK: lb a0, %pcrel_lo(.Lpcrel_hi21)(a0)
142 lb a0, a_symbol
144 # CHECK: .Lpcrel_hi22:
145 # CHECK: auipc a1, %pcrel_hi(a_symbol)
146 # CHECK: lh a1, %pcrel_lo(.Lpcrel_hi22)(a1)
147 lh a1, a_symbol
149 # CHECK: .Lpcrel_hi23:
150 # CHECK: auipc a2, %pcrel_hi(a_symbol)
151 # CHECK: lhu a2, %pcrel_lo(.Lpcrel_hi23)(a2)
152 lhu a2, a_symbol
154 # CHECK: .Lpcrel_hi24:
155 # CHECK: auipc a3, %pcrel_hi(a_symbol)
156 # CHECK: lw a3, %pcrel_lo(.Lpcrel_hi24)(a3)
157 lw a3, a_symbol
159 # CHECK: .Lpcrel_hi25:
160 # CHECK: auipc a4, %pcrel_hi(a_symbol)
161 # CHECK: sb a3, %pcrel_lo(.Lpcrel_hi25)(a4)
162 sb a3, a_symbol, a4
164 # CHECK: .Lpcrel_hi26:
165 # CHECK: auipc a4, %pcrel_hi(a_symbol)
166 # CHECK: sh a3, %pcrel_lo(.Lpcrel_hi26)(a4)
167 sh a3, a_symbol, a4
169 # CHECK: .Lpcrel_hi27:
170 # CHECK: auipc a4, %pcrel_hi(a_symbol)
171 # CHECK: sw a3, %pcrel_lo(.Lpcrel_hi27)(a4)
172 sw a3, a_symbol, a4
174 # Check that we can load the address of symbols that are spelled like a register
175 # CHECK: .Lpcrel_hi28:
176 # CHECK: auipc a2, %pcrel_hi(zero)
177 # CHECK: lw a2, %pcrel_lo(.Lpcrel_hi28)(a2)
178 lw a2, zero
180 # CHECK: .Lpcrel_hi29:
181 # CHECK: auipc a4, %pcrel_hi(zero)
182 # CHECK: sw a3, %pcrel_lo(.Lpcrel_hi29)(a4)
183 sw a3, zero, a4