1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
3 ; RUN: -mtriple powerpc64-ibm-aix-xcoff -mattr=+aix-small-local-exec-tls < %s \
4 ; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-EXEC-SMALLCM64
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
6 ; RUN: -mtriple powerpc64-ibm-aix-xcoff --code-model=large \
7 ; RUN: -mattr=+aix-small-local-exec-tls < %s | FileCheck %s \
8 ; RUN: --check-prefix=SMALL-LOCAL-EXEC-LARGECM64
10 @ThreadLocalVarInit = thread_local(localexec) global i8 1, align 1
11 @VarInit = local_unnamed_addr global i8 87, align 1
12 @IThreadLocalVarInit = internal thread_local(localexec) global i8 1, align 1
13 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1
14 @c = thread_local(localexec) global [87 x i8] zeroinitializer, align 1
16 define nonnull ptr @AddrTest1() local_unnamed_addr #0 {
17 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: AddrTest1:
18 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
19 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r3, c[TL]@le(r13)
20 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: addi r3, r3, 1
21 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
23 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: AddrTest1:
24 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
25 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r3, c[TL]@le(r13)
26 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addi r3, r3, 1
27 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
29 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @c)
30 %arrayidx = getelementptr inbounds [87 x i8], ptr %0, i64 0, i64 1
34 define void @storeITLInit(i8 noundef zeroext %x) {
35 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeITLInit:
36 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
37 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
38 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
40 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: storeITLInit:
41 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
42 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
43 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
45 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
46 store i8 %x, ptr %0, align 1
50 define void @storeTLInit(i8 noundef zeroext %x) {
51 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeTLInit:
52 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
53 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, ThreadLocalVarInit[TL]@le(r13)
54 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
56 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: storeTLInit:
57 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
58 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, ThreadLocalVarInit[TL]@le(r13)
59 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
61 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
62 store i8 %x, ptr %0, align 1
66 define zeroext i8 @loadITLInit() {
67 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadITLInit:
68 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
69 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
70 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
72 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadITLInit:
73 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
74 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
75 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
77 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
78 %1 = load i8, ptr %0, align 1
82 define zeroext i8 @loadITLInit2() {
83 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadITLInit2:
84 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
85 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r3, L..C0(r2) # @VarInit
86 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r4, IThreadLocalVarInit[TL]@le(r13)
87 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, 0(r3)
88 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r3, r4
89 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: clrldi r3, r3, 56
90 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
92 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadITLInit2:
93 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
94 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r3, L..C0@u(r2)
95 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r4, IThreadLocalVarInit[TL]@le(r13)
96 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r3, L..C0@l(r3)
97 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, 0(r3)
98 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r3, r4
99 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: clrldi r3, r3, 56
100 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
102 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
103 %1 = load i8, ptr %0, align 1
104 %2 = load i8, ptr @VarInit, align 1
109 define zeroext i8 @loadTLInit() {
110 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadTLInit:
111 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
112 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
113 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
115 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadTLInit:
116 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
117 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
118 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
120 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
121 %1 = load i8, ptr %0, align 1
125 define zeroext i8 @loadTLInit2() {
126 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadTLInit2:
127 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
128 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r3, L..C0(r2) # @VarInit
129 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r4, ThreadLocalVarInit[TL]@le(r13)
130 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, 0(r3)
131 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r3, r4
132 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: clrldi r3, r3, 56
133 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
135 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadTLInit2:
136 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
137 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r3, L..C0@u(r2)
138 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r4, ThreadLocalVarInit[TL]@le(r13)
139 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r3, L..C0@l(r3)
140 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, 0(r3)
141 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r3, r4
142 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: clrldi r3, r3, 56
143 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
145 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
146 %1 = load i8, ptr %0, align 1
147 %2 = load i8, ptr @VarInit, align 1
152 define void @loadStore1(i8 noundef zeroext %x) {
153 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadStore1:
154 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
155 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
156 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: addi r3, r3, 9
157 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
158 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
160 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadStore1:
161 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
162 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
163 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addi r3, r3, 9
164 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
165 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
167 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
168 %1 = load i8, ptr %0, align 1
170 store i8 %add, ptr %0, align 1