[VPlan] Use Operands to create VPReplicateRecipe for invar store. (NFC)
[llvm-project.git] / llvm / test / MC / LoongArch / Relocations / relocations.s
blob091dce200b7de0b693339a2d008f9b399a573e31
1 # RUN: llvm-mc --triple=loongarch64 < %s --show-encoding \
2 # RUN: | FileCheck --check-prefixes=INSTR,FIXUP %s
3 # RUN: llvm-mc --filetype=obj --triple=loongarch64 < %s \
4 # RUN: | llvm-readobj -r - | FileCheck --check-prefix=RELOC %s
6 ## Check prefixes:
7 ## RELOC - Check the relocation in the object.
8 ## FIXUP - Check the fixup on the instruction.
9 ## INSTR - Check the instruction is handled properly by the ASMPrinter.
11 .long foo
12 # RELOC: R_LARCH_32 foo
14 .quad foo
15 # RELOC: R_LARCH_64 foo
17 bne $t1, $t2, %b16(foo)
18 # RELOC: R_LARCH_B16
19 # INSTR: bne $t1, $t2, %b16(foo)
20 # FIXUP: fixup A - offset: 0, value: %b16(foo), kind: fixup_loongarch_b16
22 bnez $t1, %b21(foo)
23 # RELOC: R_LARCH_B21
24 # INSTR: bnez $t1, %b21(foo)
25 # FIXUP: fixup A - offset: 0, value: %b21(foo), kind: fixup_loongarch_b21
27 bl %plt(foo)
28 # RELOC: R_LARCH_B26
29 # INSTR: bl %plt(foo)
30 # FIXUP: fixup A - offset: 0, value: %plt(foo), kind: fixup_loongarch_b26
32 bl foo
33 # RELOC: R_LARCH_B26
34 # INSTR: bl foo
35 # FIXUP: fixup A - offset: 0, value: foo, kind: fixup_loongarch_b26
37 lu12i.w $t1, %abs_hi20(foo)
38 # RELOC: R_LARCH_ABS_HI20 foo 0x0
39 # INSTR: lu12i.w $t1, %abs_hi20(foo)
40 # FIXUP: fixup A - offset: 0, value: %abs_hi20(foo), kind: fixup_loongarch_abs_hi20
42 ori $t1, $t1, %abs_lo12(foo)
43 # RELOC: R_LARCH_ABS_LO12 foo 0x0
44 # INSTR: ori $t1, $t1, %abs_lo12(foo)
45 # FIXUP: fixup A - offset: 0, value: %abs_lo12(foo), kind: fixup_loongarch_abs_lo12
47 lu32i.d $t1, %abs64_lo20(foo)
48 # RELOC: R_LARCH_ABS64_LO20 foo 0x0
49 # INSTR: lu32i.d $t1, %abs64_lo20(foo)
50 # FIXUP: fixup A - offset: 0, value: %abs64_lo20(foo), kind: fixup_loongarch_abs64_lo20
52 lu52i.d $t1, $t1, %abs64_hi12(foo)
53 # RELOC: R_LARCH_ABS64_HI12 foo 0x0
54 # INSTR: lu52i.d $t1, $t1, %abs64_hi12(foo)
55 # FIXUP: fixup A - offset: 0, value: %abs64_hi12(foo), kind: fixup_loongarch_abs64_hi12
57 pcalau12i $t1, %pc_hi20(foo)
58 # RELOC: R_LARCH_PCALA_HI20 foo 0x0
59 # INSTR: pcalau12i $t1, %pc_hi20(foo)
60 # FIXUP: fixup A - offset: 0, value: %pc_hi20(foo), kind: FK_NONE
62 pcalau12i $t1, %pc_hi20(foo+4)
63 # RELOC: R_LARCH_PCALA_HI20 foo 0x4
64 # INSTR: pcalau12i $t1, %pc_hi20(foo+4)
65 # FIXUP: fixup A - offset: 0, value: %pc_hi20(foo+4), kind: FK_NONE
67 addi.d $t1, $t1, %pc_lo12(foo)
68 # RELOC: R_LARCH_PCALA_LO12 foo 0x0
69 # INSTR: addi.d $t1, $t1, %pc_lo12(foo)
70 # FIXUP: fixup A - offset: 0, value: %pc_lo12(foo), kind: FK_NONE
72 addi.d $t1, $t1, %pc_lo12(foo+4)
73 # RELOC: R_LARCH_PCALA_LO12 foo 0x4
74 # INSTR: addi.d $t1, $t1, %pc_lo12(foo+4)
75 # FIXUP: fixup A - offset: 0, value: %pc_lo12(foo+4), kind: FK_NONE
77 jirl $zero, $t1, %pc_lo12(foo)
78 # RELOC: R_LARCH_PCALA_LO12 foo 0x0
79 # INSTR: jirl $zero, $t1, %pc_lo12(foo)
80 # FIXUP: fixup A - offset: 0, value: %pc_lo12(foo), kind: FK_NONE
82 st.b $t1, $a2, %pc_lo12(foo)
83 # RELOC: R_LARCH_PCALA_LO12 foo 0x0
84 # INSTR: st.b $t1, $a2, %pc_lo12(foo)
85 # FIXUP: fixup A - offset: 0, value: %pc_lo12(foo), kind: FK_NONE
87 st.b $t1, $a2, %pc_lo12(foo+4)
88 # RELOC: R_LARCH_PCALA_LO12 foo 0x4
89 # INSTR: st.b $t1, $a2, %pc_lo12(foo+4)
90 # FIXUP: fixup A - offset: 0, value: %pc_lo12(foo+4), kind: FK_NONE
92 lu32i.d $t1, %pc64_lo20(foo)
93 # RELOC: R_LARCH_PCALA64_LO20 foo 0x0
94 # INSTR: lu32i.d $t1, %pc64_lo20(foo)
95 # FIXUP: fixup A - offset: 0, value: %pc64_lo20(foo), kind: FK_NONE
97 lu52i.d $t1, $t1, %pc64_hi12(foo)
98 # RELOC: R_LARCH_PCALA64_HI12 foo 0x0
99 # INSTR: lu52i.d $t1, $t1, %pc64_hi12(foo)
100 # FIXUP: fixup A - offset: 0, value: %pc64_hi12(foo), kind: FK_NONE
102 pcalau12i $t1, %got_pc_hi20(foo)
103 # RELOC: R_LARCH_GOT_PC_HI20 foo 0x0
104 # INSTR: pcalau12i $t1, %got_pc_hi20(foo)
105 # FIXUP: fixup A - offset: 0, value: %got_pc_hi20(foo), kind: FK_NONE
107 ld.d $t1, $a2, %got_pc_lo12(foo)
108 # RELOC: R_LARCH_GOT_PC_LO12 foo 0x0
109 # INSTR: ld.d $t1, $a2, %got_pc_lo12(foo)
110 # FIXUP: fixup A - offset: 0, value: %got_pc_lo12(foo), kind: FK_NONE
112 lu32i.d $t1, %got64_pc_lo20(foo)
113 # RELOC: R_LARCH_GOT64_PC_LO20 foo 0x0
114 # INSTR: lu32i.d $t1, %got64_pc_lo20(foo)
115 # FIXUP: fixup A - offset: 0, value: %got64_pc_lo20(foo), kind: FK_NONE
117 lu52i.d $t1, $t1, %got64_pc_hi12(foo)
118 # RELOC: R_LARCH_GOT64_PC_HI12 foo 0x0
119 # INSTR: lu52i.d $t1, $t1, %got64_pc_hi12(foo)
120 # FIXUP: fixup A - offset: 0, value: %got64_pc_hi12(foo), kind: FK_NONE
122 lu12i.w $t1, %got_hi20(foo)
123 # RELOC: R_LARCH_GOT_HI20 foo 0x0
124 # INSTR: lu12i.w $t1, %got_hi20(foo)
125 # FIXUP: fixup A - offset: 0, value: %got_hi20(foo), kind: FK_NONE
127 ori $t1, $a2, %got_lo12(foo)
128 # RELOC: R_LARCH_GOT_LO12 foo 0x0
129 # INSTR: ori $t1, $a2, %got_lo12(foo)
130 # FIXUP: fixup A - offset: 0, value: %got_lo12(foo), kind: FK_NONE
132 lu32i.d $t1, %got64_lo20(foo)
133 # RELOC: R_LARCH_GOT64_LO20 foo 0x0
134 # INSTR: lu32i.d $t1, %got64_lo20(foo)
135 # FIXUP: fixup A - offset: 0, value: %got64_lo20(foo), kind: FK_NONE
137 lu52i.d $t1, $t1, %got64_hi12(foo)
138 # RELOC: R_LARCH_GOT64_HI12 foo 0x0
139 # INSTR: lu52i.d $t1, $t1, %got64_hi12(foo)
140 # FIXUP: fixup A - offset: 0, value: %got64_hi12(foo), kind: FK_NONE
142 lu12i.w $t1, %le_hi20(foo)
143 # RELOC: R_LARCH_TLS_LE_HI20 foo 0x0
144 # INSTR: lu12i.w $t1, %le_hi20(foo)
145 # FIXUP: fixup A - offset: 0, value: %le_hi20(foo), kind: fixup_loongarch_tls_le_hi20
147 ori $t1, $a2, %le_lo12(foo)
148 # RELOC: R_LARCH_TLS_LE_LO12 foo 0x0
149 # INSTR: ori $t1, $a2, %le_lo12(foo)
150 # FIXUP: fixup A - offset: 0, value: %le_lo12(foo), kind: fixup_loongarch_tls_le_lo12
152 lu32i.d $t1, %le64_lo20(foo)
153 # RELOC: R_LARCH_TLS_LE64_LO20 foo 0x0
154 # INSTR: lu32i.d $t1, %le64_lo20(foo)
155 # FIXUP: fixup A - offset: 0, value: %le64_lo20(foo), kind: fixup_loongarch_tls_le64_lo20
157 lu52i.d $t1, $t1, %le64_hi12(foo)
158 # RELOC: R_LARCH_TLS_LE64_HI12 foo 0x0
159 # INSTR: lu52i.d $t1, $t1, %le64_hi12(foo)
160 # FIXUP: fixup A - offset: 0, value: %le64_hi12(foo), kind: fixup_loongarch_tls_le64_hi12
162 pcalau12i $t1, %ie_pc_hi20(foo)
163 # RELOC: R_LARCH_TLS_IE_PC_HI20 foo 0x0
164 # INSTR: pcalau12i $t1, %ie_pc_hi20(foo)
165 # FIXUP: fixup A - offset: 0, value: %ie_pc_hi20(foo), kind: FK_NONE
167 ld.d $t1, $a2, %ie_pc_lo12(foo)
168 # RELOC: R_LARCH_TLS_IE_PC_LO12 foo 0x0
169 # INSTR: ld.d $t1, $a2, %ie_pc_lo12(foo)
170 # FIXUP: fixup A - offset: 0, value: %ie_pc_lo12(foo), kind: FK_NONE
172 lu32i.d $t1, %ie64_pc_lo20(foo)
173 # RELOC: R_LARCH_TLS_IE64_PC_LO20 foo 0x0
174 # INSTR: lu32i.d $t1, %ie64_pc_lo20(foo)
175 # FIXUP: fixup A - offset: 0, value: %ie64_pc_lo20(foo), kind: FK_NONE
177 lu52i.d $t1, $t1, %ie64_pc_hi12(foo)
178 # RELOC: R_LARCH_TLS_IE64_PC_HI12 foo 0x0
179 # INSTR: lu52i.d $t1, $t1, %ie64_pc_hi12(foo)
180 # FIXUP: fixup A - offset: 0, value: %ie64_pc_hi12(foo), kind: FK_NONE
182 lu12i.w $t1, %ie_hi20(foo)
183 # RELOC: R_LARCH_TLS_IE_HI20 foo 0x0
184 # INSTR: lu12i.w $t1, %ie_hi20(foo)
185 # FIXUP: fixup A - offset: 0, value: %ie_hi20(foo), kind: FK_NONE
187 ori $t1, $a2, %ie_lo12(foo)
188 # RELOC: R_LARCH_TLS_IE_LO12 foo 0x0
189 # INSTR: ori $t1, $a2, %ie_lo12(foo)
190 # FIXUP: fixup A - offset: 0, value: %ie_lo12(foo), kind: FK_NONE
192 lu32i.d $t1, %ie64_lo20(foo)
193 # RELOC: R_LARCH_TLS_IE64_LO20 foo 0x0
194 # INSTR: lu32i.d $t1, %ie64_lo20(foo)
195 # FIXUP: fixup A - offset: 0, value: %ie64_lo20(foo), kind: FK_NONE
197 lu52i.d $t1, $t1, %ie64_hi12(foo)
198 # RELOC: R_LARCH_TLS_IE64_HI12 foo 0x0
199 # INSTR: lu52i.d $t1, $t1, %ie64_hi12(foo)
200 # FIXUP: fixup A - offset: 0, value: %ie64_hi12(foo), kind: FK_NONE
202 pcalau12i $t1, %ld_pc_hi20(foo)
203 # RELOC: R_LARCH_TLS_LD_PC_HI20 foo 0x0
204 # INSTR: pcalau12i $t1, %ld_pc_hi20(foo)
205 # FIXUP: fixup A - offset: 0, value: %ld_pc_hi20(foo), kind: FK_NONE
207 lu12i.w $t1, %ld_hi20(foo)
208 # RELOC: R_LARCH_TLS_LD_HI20 foo 0x0
209 # INSTR: lu12i.w $t1, %ld_hi20(foo)
210 # FIXUP: fixup A - offset: 0, value: %ld_hi20(foo), kind: FK_NONE
212 pcalau12i $t1, %gd_pc_hi20(foo)
213 # RELOC: R_LARCH_TLS_GD_PC_HI20 foo 0x0
214 # INSTR: pcalau12i $t1, %gd_pc_hi20(foo)
215 # FIXUP: fixup A - offset: 0, value: %gd_pc_hi20(foo), kind: FK_NONE
217 lu12i.w $t1, %gd_hi20(foo)
218 # RELOC: R_LARCH_TLS_GD_HI20 foo 0x0
219 # INSTR: lu12i.w $t1, %gd_hi20(foo)
220 # FIXUP: fixup A - offset: 0, value: %gd_hi20(foo), kind: FK_NONE
222 pcaddu18i $t1, %call36(foo)
223 # RELOC: R_LARCH_CALL36 foo 0x0
224 # INSTR: pcaddu18i $t1, %call36(foo)
225 # FIXUP: fixup A - offset: 0, value: %call36(foo), kind: FK_NONE
227 pcalau12i $t1, %desc_pc_hi20(foo)
228 # RELOC: R_LARCH_TLS_DESC_PC_HI20 foo 0x0
229 # INSTR: pcalau12i $t1, %desc_pc_hi20(foo)
230 # FIXUP: fixup A - offset: 0, value: %desc_pc_hi20(foo), kind: FK_NONE
232 addi.d $t1, $t1, %desc_pc_lo12(foo)
233 # RELOC: R_LARCH_TLS_DESC_PC_LO12 foo 0x0
234 # INSTR: addi.d $t1, $t1, %desc_pc_lo12(foo)
235 # FIXUP: fixup A - offset: 0, value: %desc_pc_lo12(foo), kind: FK_NONE
237 lu32i.d $t1, %desc64_pc_lo20(foo)
238 # RELOC: R_LARCH_TLS_DESC64_PC_LO20 foo 0x0
239 # INSTR: lu32i.d $t1, %desc64_pc_lo20(foo)
240 # FIXUP: fixup A - offset: 0, value: %desc64_pc_lo20(foo), kind: FK_NONE
242 lu52i.d $t1, $t1, %desc64_pc_hi12(foo)
243 # RELOC: R_LARCH_TLS_DESC64_PC_HI12 foo 0x0
244 # INSTR: lu52i.d $t1, $t1, %desc64_pc_hi12(foo)
245 # FIXUP: fixup A - offset: 0, value: %desc64_pc_hi12(foo), kind: FK_NONE
247 ld.d $ra, $t1, %desc_ld(foo)
248 # RELOC: R_LARCH_TLS_DESC_LD foo 0x0
249 # INSTR: ld.d $ra, $t1, %desc_ld(foo)
250 # FIXUP: fixup A - offset: 0, value: %desc_ld(foo), kind: FK_NONE
252 jirl $ra, $ra, %desc_call(foo)
253 # RELOC: R_LARCH_TLS_DESC_CALL foo 0x0
254 # INSTR: jirl $ra, $ra, %desc_call(foo)
255 # FIXUP: fixup A - offset: 0, value: %desc_call(foo), kind: FK_NONE
257 lu12i.w $t1, %desc_hi20(foo)
258 # RELOC: R_LARCH_TLS_DESC_HI20 foo 0x0
259 # INSTR: lu12i.w $t1, %desc_hi20(foo)
260 # FIXUP: fixup A - offset: 0, value: %desc_hi20(foo), kind: FK_NONE
262 ori $t1, $t1, %desc_lo12(foo)
263 # RELOC: R_LARCH_TLS_DESC_LO12 foo 0x0
264 # INSTR: ori $t1, $t1, %desc_lo12(foo)
265 # FIXUP: fixup A - offset: 0, value: %desc_lo12(foo), kind: FK_NONE
267 lu32i.d $t1, %desc64_lo20(foo)
268 # RELOC: R_LARCH_TLS_DESC64_LO20 foo 0x0
269 # INSTR: lu32i.d $t1, %desc64_lo20(foo)
270 # FIXUP: fixup A - offset: 0, value: %desc64_lo20(foo), kind: FK_NONE
272 lu52i.d $t1, $t1, %desc64_hi12(foo)
273 # RELOC: R_LARCH_TLS_DESC64_HI12 foo 0x0
274 # INSTR: lu52i.d $t1, $t1, %desc64_hi12(foo)
275 # FIXUP: fixup A - offset: 0, value: %desc64_hi12(foo), kind: FK_NONE
277 lu12i.w $t1, %le_hi20_r(foo)
278 # RELOC: R_LARCH_TLS_LE_HI20_R foo 0x0
279 # INSTR: lu12i.w $t1, %le_hi20_r(foo)
280 # FIXUP: fixup A - offset: 0, value: %le_hi20_r(foo), kind: FK_NONE
282 add.d $t1, $t2, $tp, %le_add_r(foo)
283 # RELOC: R_LARCH_TLS_LE_ADD_R foo 0x0
284 # INSTR: add.d $t1, $t2, $tp, %le_add_r(foo)
285 # FIXUP: fixup A - offset: 0, value: %le_add_r(foo), kind: FK_NONE
287 addi.d $t1, $a2, %le_lo12_r(foo)
288 # RELOC: R_LARCH_TLS_LE_LO12_R foo 0x0
289 # INSTR: addi.d $t1, $a2, %le_lo12_r(foo)
290 # FIXUP: fixup A - offset: 0, value: %le_lo12_r(foo), kind: FK_NONE
292 pcaddi $t1, %pcrel_20(foo)
293 # RELOC: R_LARCH_PCREL20_S2 foo 0x0
294 # INSTR: pcaddi $t1, %pcrel_20(foo)
295 # FIXUP: fixup A - offset: 0, value: %pcrel_20(foo), kind: FK_NONE
297 pcaddi $t1, %ld_pcrel_20(foo)
298 # RELOC: R_LARCH_TLS_LD_PCREL20_S2 foo 0x0
299 # INSTR: pcaddi $t1, %ld_pcrel_20(foo)
300 # FIXUP: fixup A - offset: 0, value: %ld_pcrel_20(foo), kind: FK_NONE
302 pcaddi $t1, %gd_pcrel_20(foo)
303 # RELOC: R_LARCH_TLS_GD_PCREL20_S2 foo 0x0
304 # INSTR: pcaddi $t1, %gd_pcrel_20(foo)
305 # FIXUP: fixup A - offset: 0, value: %gd_pcrel_20(foo), kind: FK_NONE
307 pcaddi $t1, %desc_pcrel_20(foo)
308 # RELOC: R_LARCH_TLS_DESC_PCREL20_S2 foo 0x0
309 # INSTR: pcaddi $t1, %desc_pcrel_20(foo)
310 # FIXUP: fixup A - offset: 0, value: %desc_pcrel_20(foo), kind: FK_NONE