1 ; RUN: llc -mtriple=ppc64le -relocation-model=static < %s | FileCheck %s
3 @default = global i32 55
4 define dso_local ptr @get_default_global() {
5 ; CHECK-LABEL: get_default_global:
6 ; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
7 ; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
12 @local_global = dso_local global i32 55
13 define dso_local ptr @get_local_global() {
14 ; CHECK-LABEL: get_local_global:
15 ; CHECK: addis 3, 2, local_global@toc@ha
16 ; CHECK-NEXT: addi 3, 3, local_global@toc@l
21 @preemptable_global = dso_preemptable global i32 42
22 define dso_local ptr @get_preemptable_global() {
23 ; CHECK-LABEL: get_preemptable_global:
24 ; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
25 ; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
27 ret ptr @preemptable_global
31 @external_default_global = external global i32
32 define dso_local ptr @get_external_default_global() {
33 ; CHECK-LABEL: get_external_default_global:
34 ; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
35 ; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
37 ret ptr @external_default_global
40 @external_local_global = external dso_local global i32
41 define dso_local ptr @get_external_local_global() {
42 ; CHECK-LABEL: get_external_local_global:
43 ; CHECK: addis 3, 2, external_local_global@toc@ha
44 ; CHECK-NEXT: addi 3, 3, external_local_global@toc@l
46 ret ptr @external_local_global
49 @external_preemptable_global = external dso_preemptable global i32
50 define dso_local ptr @get_external_preemptable_global() {
51 ; CHECK-LABEL: get_external_preemptable_global:
52 ; CHECK: addis 3, 2, .LC{{.*}}@toc@ha
53 ; CHECK-NEXT: ld 3, .LC{{.*}}@toc@l(3)
55 ret ptr @external_preemptable_global
60 define signext i32 @default_function(i32 %i) {
63 define dso_local signext i32 @default_function_caller(i32 %i) {
64 ; CHECK-LABEL: default_function_caller:
65 ; CHECK: bl default_function
67 %call = notail call signext i32 @default_function(i32 signext %i)
71 define dso_local signext i32 @local_function(i32 %i) {
74 define dso_local signext i32 @local_function_caller(i32 %i) {
75 ; CHECK-LABEL: local_function_caller:
76 ; CHECK: bl local_function
79 %call = notail call signext i32 @local_function(i32 signext %i)
83 define dso_preemptable signext i32 @preemptable_function(i32 %i) {
86 define dso_local signext i32 @preemptable_function_caller(i32 %i) {
87 ; CHECK-LABEL: preemptable_function_caller:
88 ; CHECK: bl preemptable_function
90 %call = notail call signext i32 @preemptable_function(i32 signext %i)
95 declare i32 @external_default_function(i32 %i)
96 define dso_local i32 @external_default_function_caller(i32 %i) {
97 ; CHECK-LABEL: external_default_function_caller:
98 ; CHECK: bl external_default_function
101 %call = notail call signext i32 @external_default_function(i32 signext %i)
105 declare dso_local i32 @external_local_function(i32 %i)
106 define dso_local i32 @external_local_function_caller(i32 %i) {
107 ; CHECK-LABEL: external_local_function_caller:
108 ; CHECK: bl external_local_function
110 %call = notail call signext i32 @external_local_function(i32 signext %i)
114 declare dso_preemptable i32 @external_preemptable_function(i32 %i)
115 define dso_local i32 @external_preemptable_function_caller(i32 %i) {
116 ; CHECK-LABEL: external_preemptable_function_caller:
117 ; CHECK: bl external_preemptable_function
119 %call = notail call signext i32 @external_preemptable_function(i32 signext %i)