1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
2 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
3 ; RUN: FileCheck %s --check-prefix=CHECK-S
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
6 ; RUN: --filetype=obj < %s | \
7 ; RUN: llvm-objdump --mcpu=pwr10 -dr - | FileCheck %s --check-prefix=CHECK-O
8 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
9 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
10 ; RUN: FileCheck %s --check-prefix=CHECK-S
11 ; RUN: llc -verify-machineinstrs -target-abi=elfv2 -mtriple=powerpc64-- \
12 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
13 ; RUN: --filetype=obj < %s | \
14 ; RUN: llvm-objdump --mcpu=pwr10 -dr - | FileCheck %s --check-prefix=CHECK-O
18 @array1 = external local_unnamed_addr global [10 x i32], align 4
19 @array2 = common dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 4
21 define dso_local signext i32 @getElementLocal7() local_unnamed_addr {
22 ; CHECK-S-LABEL: getElementLocal7:
23 ; CHECK-S: # %bb.0: # %entry
24 ; CHECK-S-NEXT: plwa r3, array2@PCREL+28(0), 1
26 ; CHECK-O-LABEL: <getElementLocal7>:
27 ; CHECK-O: plwa 3, 0(0), 1
28 ; CHECK-O-NEXT: R_PPC64_PCREL34 array2+0x1c
31 %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @array2, i64 0, i64 7), align 4
35 define dso_local signext i32 @getElementLocalNegative() local_unnamed_addr {
36 ; CHECK-S-LABEL: getElementLocalNegative:
37 ; CHECK-S: # %bb.0: # %entry
38 ; CHECK-S-NEXT: plwa r3, array2@PCREL-8(0), 1
40 ; CHECK-O-LABEL: <getElementLocalNegative>:
41 ; CHECK-O: plwa 3, 0(0), 1
42 ; CHECK-O-NEXT: R_PPC64_PCREL34 array2-0x8
45 %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @array2, i64 0, i64 -2), align 4
49 define dso_local signext i32 @getElementExtern4() local_unnamed_addr {
50 ; CHECK-S-LABEL: getElementExtern4:
51 ; CHECK-S: # %bb.0: # %entry
52 ; CHECK-S-NEXT: pld r3, array1@got@pcrel(0), 1
53 ; CHECK-S-NEXT: .Lpcrel0:
54 ; CHECK-S-NEXT: .reloc .Lpcrel0-8,R_PPC64_PCREL_OPT,.-(.Lpcrel0-8)
55 ; CHECK-S-NEXT: lwa r3, 16(r3)
57 ; CHECK-O-LABEL: <getElementExtern4>:
58 ; CHECK-O: pld 3, 0(0), 1
59 ; CHECK-O-NEXT: R_PPC64_GOT_PCREL34 array1
60 ; CHECK-O-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
61 ; CHECK-O: lwa 3, 16(3)
64 %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @array1, i64 0, i64 4), align 4
68 define dso_local signext i32 @getElementExternNegative() local_unnamed_addr {
69 ; CHECK-S-LABEL: getElementExternNegative:
70 ; CHECK-S: # %bb.0: # %entry
71 ; CHECK-S-NEXT: pld r3, array1@got@pcrel(0), 1
72 ; CHECK-S-NEXT: .Lpcrel1:
73 ; CHECK-S-NEXT: .reloc .Lpcrel1-8,R_PPC64_PCREL_OPT,.-(.Lpcrel1-8)
74 ; CHECK-S-NEXT: lwa r3, -4(r3)
76 ; CHECK-O-LABEL: <getElementExternNegative>:
77 ; CHECK-O: pld 3, 0(0), 1
78 ; CHECK-O-NEXT: R_PPC64_GOT_PCREL34 array1
79 ; CHECK-O-NEXT: R_PPC64_PCREL_OPT *ABS*+0x8
80 ; CHECK-O: lwa 3, -4(3)
83 %0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @array1, i64 0, i64 -1), align 4