1; RUN: llc < %s -mtriple=powerpc -relocation-model=pic | \
2; RUN:    FileCheck -check-prefixes=SMALL,SMALL-BSS %s
3; RUN: llc < %s -mtriple=powerpc -relocation-model=pic -mattr=+secure-plt | \
4; RUN:    FileCheck -check-prefixes=SMALL,SMALL-SECURE %s
5@bar = common global i32 0, align 4
6
7declare i32 @call_foo(i32, ...)
8
9define i32 @foo() {
10entry:
11  %0 = load i32, i32* @bar, align 4
12  %call = call i32 (i32, ...) @call_foo(i32 %0, i32 0, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64)
13  ret i32 0
14}
15
16!llvm.module.flags = !{!0}
17!0 = !{i32 1, !"PIC Level", i32 1}
18; SMALL-LABEL: foo:
19; SMALL:         stwu 1, -32(1)
20; SMALL:         stw 30, 24(1)
21; SMALL-BSS:     bl _GLOBAL_OFFSET_TABLE_@local-4
22; SMALL-SECURE:  bl .L0$pb
23; SMALL:         mflr 30
24; SMALL-SECURE:  addis 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@ha
25; SMALL-SECURE:  addi 30, 30, _GLOBAL_OFFSET_TABLE_-.L0$pb@l
26; SMALL-DAG:     stw {{[0-9]+}}, 8(1)
27; SMALL-DAG:     lwz [[VREG:[0-9]+]], bar@GOT(30)
28; SMALL-DAG:     lwz {{[0-9]+}}, 0([[VREG]])
29; SMALL:         bl call_foo@PLT{{$}}
30; SMALL:         lwz 30, 24(1)
31