Debian Codegraph @

llvm/test/CodeGen/PowerPC/dsolocal-static.ll

raw
1 ; RUN: llc -mtriple=ppc64le -relocation-model=static < %s | FileCheck %s
2
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)
8 ; CHECK-NEXT: blr
9 ret ptr @default
10 }
11
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
17 ; CHECK-NEXT: blr
18 ret ptr @local_global
19 }
20
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)
26 ; CHECK-NEXT: blr
27 ret ptr @preemptable_global
28 }
29
30
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)
36 ; CHECK-NEXT: blr
37 ret ptr @external_default_global
38 }
39
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
45 ; CHECK-NEXT: blr
46 ret ptr @external_local_global
47 }
48
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)
54 ; CHECK-NEXT: blr
55 ret ptr @external_preemptable_global
56 }
57
58
59 ; functions
60 define signext i32 @default_function(i32 %i) {
61 ret i32 %i
62 }
63 define dso_local signext i32 @default_function_caller(i32 %i) {
64 ; CHECK-LABEL: default_function_caller:
65 ; CHECK: bl default_function
66 ; CHECK-NEXT: nop
67 %call = notail call signext i32 @default_function(i32 signext %i)
68 ret i32 %call
69 }
70
71 define dso_local signext i32 @local_function(i32 %i) {
72 ret i32 %i
73 }
74 define dso_local signext i32 @local_function_caller(i32 %i) {
75 ; CHECK-LABEL: local_function_caller:
76 ; CHECK: bl local_function
77 ; CHECK-NOT: nop
78 ; CHECK: blr
79 %call = notail call signext i32 @local_function(i32 signext %i)
80 ret i32 %call
81 }
82
83 define dso_preemptable signext i32 @preemptable_function(i32 %i) {
84 ret i32 %i
85 }
86 define dso_local signext i32 @preemptable_function_caller(i32 %i) {
87 ; CHECK-LABEL: preemptable_function_caller:
88 ; CHECK: bl preemptable_function
89 ; CHECK-NEXT: nop
90 %call = notail call signext i32 @preemptable_function(i32 signext %i)
91 ret i32 %call
92 }
93
94
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
99 ; CHECK-NEXT: nop
100 ; CHECK: blr
101 %call = notail call signext i32 @external_default_function(i32 signext %i)
102 ret i32 %call
103 }
104
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
109 ; CHECK-NEXT: nop
110 %call = notail call signext i32 @external_local_function(i32 signext %i)
111 ret i32 %call
112 }
113
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
118 ; CHECK-NEXT: nop
119 %call = notail call signext i32 @external_preemptable_function(i32 signext %i)
120 ret i32 %call
121 }