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+1(r13)
20 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
22 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: AddrTest1:
23 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
24 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r3, c[TL]@le+1(r13)
25 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
27 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @c)
28 %arrayidx = getelementptr inbounds [87 x i8], ptr %0, i64 0, i64 1
32 define void @storeITLInit(i8 noundef zeroext %x) {
33 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeITLInit:
34 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
35 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
36 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
38 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: storeITLInit:
39 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
40 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
41 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
43 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
44 store i8 %x, ptr %0, align 1
48 define void @storeTLInit(i8 noundef zeroext %x) {
49 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeTLInit:
50 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
51 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, ThreadLocalVarInit[TL]@le(r13)
52 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
54 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: storeTLInit:
55 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
56 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, ThreadLocalVarInit[TL]@le(r13)
57 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
59 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
60 store i8 %x, ptr %0, align 1
64 define zeroext i8 @loadITLInit() {
65 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadITLInit:
66 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
67 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
68 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
70 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadITLInit:
71 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
72 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
73 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
75 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
76 %1 = load i8, ptr %0, align 1
80 define zeroext i8 @loadITLInit2() {
81 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadITLInit2:
82 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
83 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r4, L..C0(r2) # @VarInit
84 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
85 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r4, 0(r4)
86 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r4, r3
87 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: clrldi r3, r3, 56
88 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
90 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadITLInit2:
91 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
92 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r4, L..C0@u(r2)
93 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
94 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r4, L..C0@l(r4)
95 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r4, 0(r4)
96 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r4, r3
97 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: clrldi r3, r3, 56
98 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
100 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
101 %1 = load i8, ptr %0, align 1
102 %2 = load i8, ptr @VarInit, align 1
107 define zeroext i8 @loadTLInit() {
108 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadTLInit:
109 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
110 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
111 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
113 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadTLInit:
114 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
115 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
116 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
118 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
119 %1 = load i8, ptr %0, align 1
123 define zeroext i8 @loadTLInit2() {
124 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadTLInit2:
125 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
126 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r4, L..C0(r2) # @VarInit
127 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
128 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r4, 0(r4)
129 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r4, r3
130 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: clrldi r3, r3, 56
131 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
133 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadTLInit2:
134 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
135 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r4, L..C0@u(r2)
136 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, ThreadLocalVarInit[TL]@le(r13)
137 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r4, L..C0@l(r4)
138 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r4, 0(r4)
139 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r4, r3
140 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: clrldi r3, r3, 56
141 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
143 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalVarInit)
144 %1 = load i8, ptr %0, align 1
145 %2 = load i8, ptr @VarInit, align 1
150 define void @loadStore1(i8 noundef zeroext %x) {
151 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadStore1:
152 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
153 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
154 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: addi r3, r3, 9
155 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
156 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
158 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: loadStore1:
159 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
160 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lbz r3, IThreadLocalVarInit[TL]@le(r13)
161 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addi r3, r3, 9
162 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stb r3, IThreadLocalVarInit[TL]@le(r13)
163 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
165 %0 = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @IThreadLocalVarInit)
166 %1 = load i8, ptr %0, align 1
168 store i8 %add, ptr %0, align 1