1 # RUN: llvm-mc -triple=powerpc64le -filetype=obj %s | \
2 # RUN: llvm-objdump -dr --mcpu=pwr10 - | FileCheck %s
3 # RUN: llvm-mc -triple=powerpc64 -filetype=obj %s | \
4 # RUN: llvm-objdump -dr --mcpu=pwr10 - | FileCheck %s
8 # This section of tests contains the MCBinaryExpr as the first parameter of the
15 .type Minimal,@function
18 pld
3, vec@got@pcrel
(0), 1
20 .reloc .Lpcrel1-8,R_PPC64_PCREL_OPT,.-(.Lpcrel1-8)
25 # CHECK-LABEL: Minimal
26 # CHECK: pld 3, 0(0), 1
27 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
28 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
29 # CHECK-NEXT: lwa 3, 4(3)
32 .globl SingleInsnBetween
34 .type SingleInsnBetween,@function
36 .LSingleInsnBetween$local:
37 pld
3, vec@got@pcrel
(0), 1
40 .reloc .Lpcrel2-8,R_PPC64_PCREL_OPT,.-(.Lpcrel2-8)
45 # CHECK-LABEL: SingleInsnBetween
46 # CHECK: pld 3, 0(0), 1
47 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
48 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0xc
49 # CHECK-NEXT: addi 3, 3, 42
50 # CHECK-NEXT: lwa 3, 4(3)
54 .globl MultiInsnBetween # -- Begin function
56 .type MultiInsnBetween,@function
58 .LMultiInsnBetween$local:
59 pld
3, vec@got@pcrel
(0), 1
66 .reloc .Lpcrel3-8,R_PPC64_PCREL_OPT,.-(.Lpcrel3-8)
71 # CHECK-LABEL: MultiInsnBetween
72 # CHECK: pld 3, 0(0), 1
73 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
74 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x1c
75 # CHECK-NEXT: addi 3, 3, 42
76 # CHECK-NEXT: addi 3, 3, 42
77 # CHECK-NEXT: addi 3, 3, 42
78 # CHECK-NEXT: addi 3, 3, 42
79 # CHECK-NEXT: addi 3, 3, 42
80 # CHECK-NEXT: lwa 3, 4(3)
83 .globl PrefixInsnBetween
85 .type PrefixInsnBetween,@function
86 .space 48 # Add a space to force an alignment of a paddi.
88 .LPrefixInsnBetween$local:
89 pld
3, vec@got@pcrel
(0), 1
96 .reloc .Lpcrel4-8,R_PPC64_PCREL_OPT,.-(.Lpcrel4-8)
101 # CHECK-LABEL: PrefixInsnBetween
102 # CHECK: pld 3, 0(0), 1
103 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
104 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x28
105 # CHECK-NEXT: addi 3, 3, 42
107 # CHECK-NEXT: paddi 3, 3, 42, 0
108 # CHECK-NEXT: addi 3, 3, 42
109 # CHECK-NEXT: paddi 3, 3, 42, 0
110 # CHECK-NEXT: addi 3, 3, 42
111 # CHECK-NEXT: lwa 3, 4(3)
115 .globl SpaceBetween # -- Begin function
117 .type SpaceBetween,@function
119 .LSpaceBetween$local:
120 pld
3, vec@got@pcrel
(0), 1
128 .reloc .Lpcrel5-8,R_PPC64_PCREL_OPT,.-(.Lpcrel5-8)
133 # CHECK-LABEL: SpaceBetween
134 # CHECK: pld 3, 0(0), 1
135 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
136 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x50
137 # CHECK-NEXT: addi 3, 3, 42
139 # CHECK-NEXT: paddi 3, 3, 42, 0
140 # CHECK-NEXT: addi 3, 3, 42
141 # CHECK: paddi 3, 3, 42, 0
142 # CHECK-NEXT: addi 3, 3, 42
143 # CHECK-NEXT: lwa 3, 4(3)
155 pld
3, vec@got@pcrel
(0), 1
156 .reloc .Lpcrel6+8,R_PPC64_PCREL_OPT,.-(.Lpcrel6+8)
162 # CHECK: pld 3, 0(0), 1
163 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
164 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
165 # CHECK-NEXT: lwa 3, 4(3)
169 # This section of tests contains the variable MCSymbol as part of the
170 # MCSymbolRefExpr for the first parameter of the .reloc relocation.
172 .globl VarLabelMinimal # -- Begin function
174 .type VarLabelMinimal,@function
176 .LVarLabelMinimal$local:
177 pld
3, vec@got@pcrel
(0), 1
179 .reloc .Lpcrel101,R_PPC64_PCREL_OPT,.-.Lpcrel101
184 # CHECK-LABEL: VarLabelMinimal
185 # CHECK: pld 3, 0(0), 1
186 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
187 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
188 # CHECK-NEXT: lwa 3, 4(3)
192 .globl VarLabelSingleInsnBetween
194 .type VarLabelSingleInsnBetween,@function
195 VarLabelSingleInsnBetween
:
196 .LVarLabelSingleInsnBetween$local:
197 pld
3, vec@got@pcrel
(0), 1
200 .reloc .Lpcrel102,R_PPC64_PCREL_OPT,.-.Lpcrel102
205 # CHECK-LABEL: VarLabelSingleInsnBetween
206 # CHECK: pld 3, 0(0), 1
207 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
208 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0xc
209 # CHECK-NEXT: addi 3, 3, 42
210 # CHECK-NEXT: lwa 3, 4(3)
213 .globl VarLabelMultiInsnBetween # -- Begin function
215 .type VarLabelMultiInsnBetween,@function
216 VarLabelMultiInsnBetween
:
217 .LVarLabelMultiInsnBetween$local:
218 pld
3, vec@got@pcrel
(0), 1
225 .reloc .Lpcrel103,R_PPC64_PCREL_OPT,.-.Lpcrel103
230 # CHECK-LABEL: VarLabelMultiInsnBetween
231 # CHECK: pld 3, 0(0), 1
232 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
233 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x1c
234 # CHECK-NEXT: addi 3, 3, 42
235 # CHECK-NEXT: addi 3, 3, 42
236 # CHECK-NEXT: addi 3, 3, 42
237 # CHECK-NEXT: addi 3, 3, 42
238 # CHECK-NEXT: addi 3, 3, 42
239 # CHECK-NEXT: lwa 3, 4(3)
243 .globl VarLabelPrefixInsnBetween # -- Begin function
245 .type VarLabelPrefixInsnBetween,@function
246 VarLabelPrefixInsnBetween
:
247 .LVarLabelPrefixInsnBetween$local:
248 pld
3, vec@got@pcrel
(0), 1
255 .reloc .Lpcrel104,R_PPC64_PCREL_OPT,.-.Lpcrel104
260 # CHECK-LABEL: VarLabelPrefixInsnBetween
261 # CHECK: pld 3, 0(0), 1
262 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
263 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x24
264 # CHECK-NEXT: addi 3, 3, 42
265 # CHECK-NEXT: paddi 3, 3, 42, 0
266 # CHECK-NEXT: addi 3, 3, 42
267 # CHECK-NEXT: paddi 3, 3, 42, 0
268 # CHECK-NEXT: addi 3, 3, 42
269 # CHECK-NEXT: lwa 3, 4(3)
273 .globl VarLabelSpaceBetween # -- Begin function
275 .type VarLabelSpaceBetween,@function
276 VarLabelSpaceBetween
:
277 .LVarLabelSpaceBetween$local:
278 pld
3, vec@got@pcrel
(0), 1
286 .reloc .Lpcrel105,R_PPC64_PCREL_OPT,.-.Lpcrel105
291 # CHECK-LABEL: VarLabelSpaceBetween
292 # CHECK: pld 3, 0(0), 1
293 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
294 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x4c
295 # CHECK-NEXT: addi 3, 3, 42
296 # CHECK-NEXT: paddi 3, 3, 42, 0
297 # CHECK-NEXT: addi 3, 3, 42
298 # CHECK: paddi 3, 3, 42, 0
299 # CHECK-NEXT: addi 3, 3, 42
300 # CHECK-NEXT: lwa 3, 4(3)
306 .type VarLabelPlus,@function
308 .LVarLabelPlus$local:
312 pld
3, vec@got@pcrel
(0), 1
313 .reloc .Lpcrel106+8,R_PPC64_PCREL_OPT,.-(.Lpcrel106+8)
318 # CHECK-LABEL: VarLabelPlus
319 # CHECK: pld 3, 0(0), 1
320 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
321 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
322 # CHECK-NEXT: lwa 3, 4(3)
325 # Check the situation where the PLD requires an alignment nop.
328 .type AlignPLD,@function
329 .space 60 # Force the pld to require an alignment nop.
332 pld
3, vec@got@pcrel
(0), 1
334 .reloc .Lpcrel201-8,R_PPC64_PCREL_OPT,.-(.Lpcrel201-8)
337 # CHECK-LABEL: AlignPLD
339 # CHECK-NEXT: pld 3, 0(0), 1
340 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
341 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
342 # CHECK-NEXT: lwa 3, 4(3)
345 # The label and the pld are on the same line and so the nop is inserted before
346 # the label and the relocation should work.
347 .globl AlignPLDSameLine
349 .type AlignPLDSameLine,@function
350 .space 60 # Force the pld to require an alignment nop.
352 .LAlignPLDSameLine$local:
353 .Lpcrel202: pld 3, vec@got@pcrel(0), 1
354 .reloc .Lpcrel202,R_PPC64_PCREL_OPT,.-.Lpcrel202
357 # CHECK-LABEL: AlignPLDSameLine
359 # CHECK-NEXT: pld 3, 0(0), 1
360 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
361 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
362 # CHECK-NEXT: lwa 3, 4(3)
365 .globl AlignPLDLabelBefore
367 .type AlignPLDLabelBefore,@function
368 .space 60 # Force the pld to require an alignment nop.
370 .LAlignPLDLabelBefore$local:
372 pld
3, vec@got@pcrel
(0), 1
374 .reloc .Lpcrel203-8,R_PPC64_PCREL_OPT,.-(.Lpcrel203-8)
377 # CHECK-LABEL: AlignPLDLabelBefore
379 # CHECK-NEXT: pld 3, 0(0), 1
380 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
381 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
382 # CHECK-NEXT: lwa 3, 4(3)
385 .globl AlignPLDLabelSameLine
387 .type AlignPLDLabelSameLine,@function
388 .space 60 # Force the pld to require an alignment nop.
389 AlignPLDLabelSameLine
:
390 .Label2: pld 3, vec@got@pcrel(0), 1
392 .reloc .Lpcrel204-8,R_PPC64_PCREL_OPT,.-(.Lpcrel204-8)
395 # CHECK-LABEL: AlignPLDLabelSameLine
397 # CHECK-NEXT: pld 3, 0(0), 1
398 # CHECK-NEXT: R_PPC64_GOT_PCREL34 vec
399 # CHECK-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
400 # CHECK-NEXT: lwa 3, 4(3)