1 ; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=pic \
2 ; RUN: < %s | FileCheck %s
3 ; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=static \
4 ; RUN: < %s | FileCheck --check-prefix=STATIC %s
5 ; RUN: llc -mtriple powerpc64le-unkown-gnu-linux -relocation-model=pic \
6 ; RUN: < %s | FileCheck %s
10 @strong_default = global i32 55
11 define i32* @get_strong_default() #0 {
12 ret i32* @strong_default
14 ; STATIC-LABEL: @get_strong_default
15 ; STATIC: addis 3, 2, strong_default@toc@ha
16 ; STATIC: addi 3, 3, strong_default@toc@l
19 ; CHECK-LABEL: @get_strong_default
20 ; CHECK: addis 3, 2, .LC0@toc@ha
21 ; CHECK: ld 3, .LC0@toc@l(3)
25 @weak_default = weak global i32 55
26 define i32* @get_weak_default() #0 {
27 ret i32* @weak_default
29 ; STATIC-LABEL: @get_weak_default
30 ; STATIC: addis 3, 2, weak_default@toc@ha
31 ; STATIC: addi 3, 3, weak_default@toc@l
34 ; CHECK-LABEL: @get_weak_default
35 ; CHECK: addis 3, 2, .LC1@toc@ha
36 ; CHECK: ld 3, .LC1@toc@l(3)
40 @external_default_global = external global i32
41 define i32* @get_external_default_global() {
42 ret i32* @external_default_global
44 ; STATIC-LABEL: @get_external_default_global
45 ; STATIC: addis 3, 2, .LC0@toc@ha
46 ; STATIC: ld 3, .LC0@toc@l(3)
49 ; CHECK-LABEL: @get_external_default_global
50 ; CHECK: addis 3, 2, .LC2@toc@ha
51 ; CHECK: ld 3, .LC2@toc@l(3)
56 @strong_local_global = dso_local global i32 55
57 define i32* @get_strong_local_global() {
58 ret i32* @strong_local_global
60 ; STATIC-LABEL: @get_strong_local_global
61 ; STATIC: addis 3, 2, strong_local_global@toc@ha
62 ; STATIC: addi 3, 3, strong_local_global@toc@l
65 ; CHECK-LABEL: @get_strong_local_global
66 ; CHECK: addis 3, 2, strong_local_global@toc@ha
67 ; CHECK: addi 3, 3, strong_local_global@toc@l
71 @weak_local_global = weak dso_local global i32 42
72 define i32* @get_weak_local_global() {
73 ret i32* @weak_local_global
75 ; STATIC-LABEL: @get_weak_local_global
76 ; STATIC: addis 3, 2, weak_local_global@toc@ha
77 ; STATIC: addi 3, 3, weak_local_global@toc@l
80 ; CHECK-LABEL: @get_weak_local_global
81 ; CHECK: addis 3, 2, weak_local_global@toc@ha
82 ; CHECK: addi 3, 3, weak_local_global@toc@l
86 @external_local_global = external dso_local global i32
87 define i32* @get_external_local_global() {
88 ret i32* @external_local_global
89 ; STATIC-LABEL: @get_external_local_global
90 ; STATIC: addis 3, 2, external_local_global@toc@ha
91 ; STATIC: addi 3, 3, external_local_global@toc@l
94 ; CHECK-LABEL: @get_external_local_global
95 ; CHECK: addis 3, 2, external_local_global@toc@ha
96 ; CHECK: addi 3, 3, external_local_global@toc@l
100 @strong_preemptable_global = dso_preemptable global i32 42
101 define i32* @get_strong_preemptable_global() {
102 ret i32* @strong_preemptable_global
104 ; STATIC-LABEL: @get_strong_preemptable_global
105 ; STATIC: addis 3, 2, strong_preemptable_global@toc@ha
106 ; STATIC: addi 3, 3, strong_preemptable_global@toc@l
109 ; CHECK-LABEL: @get_strong_preemptable_global
110 ; CHECK: addis 3, 2, .LC3@toc@ha
111 ; CHECK: ld 3, .LC3@toc@l(3)
115 @weak_preemptable_global = weak dso_preemptable global i32 42
116 define i32* @get_weak_preemptable_global() {
117 ret i32* @weak_preemptable_global
119 ; STATIC-LABEL: @get_weak_preemptable_global
120 ; STATIC: addis 3, 2, weak_preemptable_global@toc@ha
121 ; STATIC: addi 3, 3, weak_preemptable_global@toc@l
124 ; CHECK-LABEL: @get_weak_preemptable_global
125 ; CHECK: addis 3, 2, .LC4@toc@ha
126 ; CHECK: ld 3, .LC4@toc@l(3)
130 @external_preemptable_global = external dso_preemptable global i32
131 define i32* @get_external_preemptable_global() {
132 ret i32* @external_preemptable_global
134 ; STATIC-LABEL: @get_external_preemptable_global
135 ; STATIC: addis 3, 2, .LC1@toc@ha
136 ; STATIC: ld 3, .LC1@toc@l(3)
139 ; CHECK-LABEL: @get_external_preemptable_global
140 ; CHECK: addis 3, 2, .LC5@toc@ha
141 ; CHECK: ld 3, .LC5@toc@l(3)
146 define signext i32 @strong_default_function(i32 %i) {
149 define signext i32 @strong_default_function_caller(i32 %i) {
150 %call = notail call signext i32 @strong_default_function(i32 signext %i)
153 ; STATIC-LABEL: @strong_default_function_caller
154 ; STATIC: bl strong_default_function
158 ; CHECK-LABEL: @strong_default_function_caller
159 ; CHECK: bl strong_default_function
164 define weak signext i32 @weak_default_function(i32 %i) {
167 define signext i32 @weak_default_function_caller(i32 %i) {
168 %call = notail call signext i32 @weak_default_function(i32 signext %i)
171 ; STATIC-LABEL: @weak_default_function_caller
172 ; STATIC: bl weak_default_function
176 ; CHECK-LABEL: @weak_default_function_caller
177 ; CHECK: bl weak_default_function
183 declare i32 @external_default_function(i32 %i)
184 define i32 @external_default_function_caller(i32 %i) {
185 %call = notail call signext i32 @external_default_function(i32 signext %i)
188 ; STATIC-LABEL: @external_default_function_caller
189 ; STATIC: bl external_default_function
193 ; CHECK-LABEL: @external_default_function_caller
194 ; CHECK: bl external_default_function
199 define dso_local signext i32 @strong_local_function(i32 %i) {
202 define signext i32 @strong_local_function_caller(i32 %i) {
203 %call = notail call signext i32 @strong_local_function(i32 signext %i)
206 ; STATIC-LABEL: @strong_local_function_caller
207 ; STATIC: bl strong_local_function
211 ; CHECK-LABEL: @strong_local_function_caller
212 ; CHECK: bl strong_local_function
217 define weak dso_local signext i32 @weak_local_function(i32 %i) {
220 define signext i32 @weak_local_function_caller(i32 %i) {
221 %call = notail call signext i32 @weak_local_function(i32 signext %i)
224 ; STATIC-LABEL: @weak_local_function_caller
225 ; STATIC: bl weak_local_function
229 ; CHECK-LABEL: @weak_local_function_caller
230 ; CHECK: bl weak_local_function
235 declare dso_local i32 @external_local_function(i32 %i)
236 define i32 @external_local_function_caller(i32 %i) {
237 %call = notail call signext i32 @external_local_function(i32 signext %i)
240 ; STATIC-LABEL: @external_local_function_caller
241 ; STATIC: bl external_local_function
245 ; CHECK-LABEL: @external_local_function_caller
246 ; CHECK: bl external_local_function
251 define dso_preemptable signext i32 @strong_preemptable_function(i32 %i) {
254 define signext i32 @strong_preemptable_function_caller(i32 %i) {
255 %call = notail call signext i32 @strong_preemptable_function(i32 signext %i)
258 ; STATIC-LABEL: @strong_preemptable_function_caller
259 ; STATIC: bl strong_preemptable_function
263 ; CHECK-LABEL: @strong_preemptable_function_caller
264 ; CHECK: bl strong_preemptable_function
269 define weak dso_preemptable signext i32 @weak_preemptable_function(i32 %i) {
272 define signext i32 @weak_preemptable_function_caller(i32 %i) {
273 %call = notail call signext i32 @weak_preemptable_function(i32 signext %i)
276 ; STATIC-LABEL: @weak_preemptable_function_caller
277 ; STATIC: bl weak_preemptable_function
281 ; CHECK-LABEL: @weak_preemptable_function_caller
282 ; CHECK: bl weak_preemptable_function
287 declare dso_preemptable i32 @external_preemptable_function(i32 %i)
288 define i32 @external_preemptable_function_caller(i32 %i) {
289 %call = notail call signext i32 @external_preemptable_function(i32 signext %i)
292 ; STATIC-LABEL: @external_preemptable_function_caller
293 ; STATIC: bl external_preemptable_function
297 ; CHECK-LABEL: @external_preemptable_function_caller
298 ; CHECK: bl external_preemptable_function