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 i16 1, align 2
11 @VarInit = local_unnamed_addr global i16 87, align 2
12 @IThreadLocalVarInit = internal thread_local(localexec) global i16 1, align 2
13 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1
14 @b = thread_local(localexec) global [87 x i16] zeroinitializer, align 2
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, b[TL]@le+4(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, b[TL]@le+4(r13)
25 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
27 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @b)
28 %arrayidx = getelementptr inbounds [87 x i16], ptr %0, i64 0, i64 2
32 define void @storeITLInit(i16 noundef signext %x) {
33 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeITLInit:
34 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
35 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: sth 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: sth r3, IThreadLocalVarInit[TL]@le(r13)
41 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
43 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @IThreadLocalVarInit)
44 store i16 %x, ptr %0, align 2
48 define void @storeTLInit(i16 noundef signext %x) {
49 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: storeTLInit:
50 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
51 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: sth 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: sth r3, ThreadLocalVarInit[TL]@le(r13)
57 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
59 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @ThreadLocalVarInit)
60 store i16 %x, ptr %0, align 2
64 define signext i16 @loadITLInit() {
65 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadITLInit:
66 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
67 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lha 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: lha r3, IThreadLocalVarInit[TL]@le(r13)
73 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
75 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @IThreadLocalVarInit)
76 %1 = load i16, ptr %0, align 2
80 define signext i16 @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: lhz r3, IThreadLocalVarInit[TL]@le(r13)
85 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lhz r4, 0(r4)
86 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r4, r3
87 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: extsh r3, r3
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: lhz r3, IThreadLocalVarInit[TL]@le(r13)
94 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r4, L..C0@l(r4)
95 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lhz r4, 0(r4)
96 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r4, r3
97 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: extsh r3, r3
98 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
100 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @IThreadLocalVarInit)
101 %1 = load i16, ptr %0, align 2
102 %2 = load i16, ptr @VarInit, align 2
103 %add = add i16 %2, %1
107 define signext i16 @loadTLInit() {
108 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadTLInit:
109 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
110 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lha 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: lha r3, ThreadLocalVarInit[TL]@le(r13)
116 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
118 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @ThreadLocalVarInit)
119 %1 = load i16, ptr %0, align 2
123 define signext i16 @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: lhz r3, ThreadLocalVarInit[TL]@le(r13)
128 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lhz r4, 0(r4)
129 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r4, r3
130 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: extsh r3, r3
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: lhz r3, ThreadLocalVarInit[TL]@le(r13)
137 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r4, L..C0@l(r4)
138 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: lhz r4, 0(r4)
139 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r4, r3
140 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: extsh r3, r3
141 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
143 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @ThreadLocalVarInit)
144 %1 = load i16, ptr %0, align 2
145 %2 = load i16, ptr @VarInit, align 2
146 %add = add i16 %2, %1
150 define void @loadStore1(i16 noundef signext %x) {
151 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: loadStore1:
152 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
153 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: lhz r3, IThreadLocalVarInit[TL]@le(r13)
154 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: addi r3, r3, 9
155 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: sth 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: lhz r3, IThreadLocalVarInit[TL]@le(r13)
161 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addi r3, r3, 9
162 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: sth r3, IThreadLocalVarInit[TL]@le(r13)
163 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
165 %0 = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @IThreadLocalVarInit)
166 %1 = load i16, ptr %0, align 2
168 store i16 %add, ptr %0, align 2