1; RUN: llc %s -o - -mtriple=powerpc | FileCheck --check-prefix=REL %s
2; RUN: llc %s -o - -mtriple=powerpc -relocation-model=pic | FileCheck --check-prefix=PLTREL %s
3; RUN: llc %s -o - -mtriple=powerpc64 | FileCheck --check-prefix=REL %s
4; RUN: llc %s -o - -mtriple=powerpc64 -relocation-model=pic | FileCheck --check-prefix=REL %s
5; RUN: llc %s -o - -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 \
6; RUN:   -verify-machineinstrs | FileCheck --check-prefix=LEP8 %s
7; RUN: llc %s -o - -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
8; RUN:   -verify-machineinstrs | FileCheck --check-prefix=LEP10 %s
9
10@ifunc1 = dso_local ifunc void(), i8*()* @resolver
11@ifunc2 = ifunc void(), i8*()* @resolver
12
13define i8* @resolver() { ret i8* null }
14
15define void @foo() #0 {
16  ; REL-LABEL:    foo
17  ; REL:          bl ifunc1{{$}}
18  ; REL:          bl ifunc2{{$}}
19  ; PLTREL-LABEL: foo
20  ; PLTREL:       bl ifunc1@PLT+32768
21  ; PLTREL:       bl ifunc2@PLT+32768
22  ; LEP8-LABEL:   foo
23  ; LEP8:         bl ifunc1
24  ; LEP8-NEXT:    nop
25  ; LEP8-NEXT:    bl ifunc2
26  ; LEP8-NEXT:    nop
27  ; LEP8:         blr
28  ; LEP10-LABEL:  foo
29  ; LEP10:        bl ifunc1@notoc
30  ; LEP10-NEXT:   bl ifunc2@notoc
31  ; LEP10-NOT:    nop
32  ; LEP10:        blr
33  call void @ifunc1()
34  call void @ifunc2()
35  ret void
36}
37
38;; Use Secure PLT ABI for PPC32.
39attributes #0 = { "target-features"="+secure-plt" }
40
41!llvm.module.flags = !{!0}
42!0 = !{i32 1, !"PIC Level", i32 2}
43