1; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck -check-prefix=LARGE-BSS %s
2; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
3; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
4; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
5; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
6; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
7; RUN: llc < %s -mtriple=powerpc-linux-musl -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
8; RUN: llc < %s -mtriple=powerpc-linux-musl -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
9@bar = common global i32 0, align 4
10
11declare i32 @call_foo(i32, ...)
12
13define i32 @foo() {
14entry:
15  %0 = load i32, i32* @bar, align 4
16  %call = call i32 (i32, ...) @call_foo(i32 %0, i32 0, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64)
17  ret i32 %0
18}
19
20!llvm.module.flags = !{!0}
21!0 = !{i32 1, !"PIC Level", i32 2}
22; LARGE-BSS:       [[POFF:\.L[0-9]+\$poff]]:
23; LARGE-BSS-NEXT:    .long .LTOC-[[PB:\.L[0-9]+\$pb]]
24; LARGE-BSS-NEXT:  foo:
25; LARGE-BSS:         stwu 1, -32(1)
26; LARGE-BSS:         stw 30, 24(1)
27; LARGE-BSS:         bl [[PB]]
28; LARGE-BSS-NEXT:  [[PB]]:
29; LARGE-BSS:         mflr 30
30; LARGE-BSS:         lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30)
31; LARGE-BSS-NEXT:    add 30, [[REG]], 30
32; LARGE-BSS-DAG:     lwz [[VREG:[0-9]+]], [[VREF:\.LC[0-9]+]]-.LTOC(30)
33; LARGE-BSS-DAG:     lwz {{[0-9]+}}, 0([[VREG]])
34; LARGE-BSS-DAG:     stw {{[0-9]+}}, 8(1)
35; LARGE-BSS:         lwz 30, 24(1)
36; LARGE-BSS:       [[VREF]]:
37; LARGE-BSS-NEXT:     .p2align 2
38; LARGE-BSS-NEXT:    .long bar
39; LARGE-SECUREPLT:   addis 30, 30, .LTOC-.L0$pb@ha
40; LARGE-SECUREPLT:   addi 30, 30, .LTOC-.L0$pb@l
41; LARGE-SECUREPLT:   bl call_foo@PLT+32768
42