1; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s
2; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s
3; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s
4; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s
5; RUN: llc < %s -relocation-model=pic -function-sections -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=CHECK-FS
6; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s
7; RUN: llc < %s -relocation-model=pic -function-sections -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s -check-prefix=CHECK-FS
8; RUN: llc < %s -relocation-model=pic -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
9; RUN: -code-model=small -mcpu=pwr8 | FileCheck %s -check-prefix=SCM
10
11%class.T = type { [2 x i8] }
12
13define void @e_callee(%class.T* %this, i8* %c) { ret void }
14define void @e_caller(%class.T* %this, i8* %c) {
15  call void @e_callee(%class.T* %this, i8* %c)
16  ret void
17
18; CHECK-LABEL: e_caller:
19; CHECK: bl e_callee
20; CHECK-NEXT: nop
21
22; CHECK-FS-LABEL: e_caller:
23; CHECK-FS: bl e_callee
24; CHECK-FS-NEXT: nop
25}
26
27define void @e_scallee(%class.T* %this, i8* %c) section "different" { ret void }
28define void @e_scaller(%class.T* %this, i8* %c) {
29  call void @e_scallee(%class.T* %this, i8* %c)
30  ret void
31
32; CHECK-LABEL: e_scaller:
33; CHECK: bl e_scallee
34; CHECK-NEXT: nop
35}
36
37define void @e_s2callee(%class.T* %this, i8* %c) { ret void }
38define void @e_s2caller(%class.T* %this, i8* %c) section "different" {
39  call void @e_s2callee(%class.T* %this, i8* %c)
40  ret void
41
42; CHECK-LABEL: e_s2caller:
43; CHECK: bl e_s2callee
44; CHECK-NEXT: nop
45}
46
47$cd1 = comdat any
48$cd2 = comdat any
49
50define void @e_ccallee(%class.T* %this, i8* %c) comdat($cd1) { ret void }
51define void @e_ccaller(%class.T* %this, i8* %c) comdat($cd2) {
52  call void @e_ccallee(%class.T* %this, i8* %c)
53  ret void
54
55; CHECK-LABEL: e_ccaller:
56; CHECK: bl e_ccallee
57; CHECK-NEXT: nop
58}
59
60$cd = comdat any
61
62define void @e_c1callee(%class.T* %this, i8* %c) comdat($cd) { ret void }
63define void @e_c1caller(%class.T* %this, i8* %c) comdat($cd) {
64  call void @e_c1callee(%class.T* %this, i8* %c)
65  ret void
66
67; CHECK-LABEL: e_c1caller:
68; CHECK: bl e_c1callee
69; CHECK-NEXT: nop
70}
71
72define weak_odr hidden void @wo_hcallee(%class.T* %this, i8* %c) { ret void }
73define void @wo_hcaller(%class.T* %this, i8* %c) {
74  call void @wo_hcallee(%class.T* %this, i8* %c)
75  ret void
76
77; CHECK-LABEL: wo_hcaller:
78; CHECK: bl wo_hcallee
79; CHECK-NEXT: nop
80
81; SCM-LABEL: wo_hcaller:
82; SCM:       bl wo_hcallee
83; SCM-NEXT:  nop
84}
85
86define weak_odr protected void @wo_pcallee(%class.T* %this, i8* %c) { ret void }
87define void @wo_pcaller(%class.T* %this, i8* %c) {
88  call void @wo_pcallee(%class.T* %this, i8* %c)
89  ret void
90
91; CHECK-LABEL: wo_pcaller:
92; CHECK: bl wo_pcallee
93; CHECK-NEXT: nop
94
95; SCM-LABEL:   wo_pcaller:
96; SCM:         bl wo_pcallee
97; SCM-NEXT:    nop
98}
99
100define weak_odr void @wo_callee(%class.T* %this, i8* %c) { ret void }
101define void @wo_caller(%class.T* %this, i8* %c) {
102  call void @wo_callee(%class.T* %this, i8* %c)
103  ret void
104
105; CHECK-LABEL: wo_caller:
106; CHECK: bl wo_callee
107; CHECK-NEXT: nop
108}
109
110define weak protected void @w_pcallee(i8* %ptr) { ret void }
111define void @w_pcaller(i8* %ptr) {
112  call void @w_pcallee(i8* %ptr)
113  ret void
114
115; CHECK-LABEL: w_pcaller:
116; CHECK: bl w_pcallee
117; CHECK-NEXT: nop
118
119; SCM-LABEL: w_pcaller:
120; SCM:       bl w_pcallee
121; SCM-NEXT:  nop
122}
123
124define weak hidden void @w_hcallee(i8* %ptr) { ret void }
125define void @w_hcaller(i8* %ptr) {
126  call void @w_hcallee(i8* %ptr)
127  ret void
128
129; CHECK-LABEL: w_hcaller:
130; CHECK: bl w_hcallee
131; CHECK-NEXT: nop
132
133; SCM-LABEL: w_hcaller:
134; SCM:       bl w_hcallee
135; SCM-NEXT:  nop
136}
137
138define weak void @w_callee(i8* %ptr) { ret void }
139define void @w_caller(i8* %ptr) {
140  call void @w_callee(i8* %ptr)
141  ret void
142
143; CHECK-LABEL: w_caller:
144; CHECK: bl w_callee
145; CHECK-NEXT: nop
146}
147
148