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 ; Test disassembly of object.
11 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=+aix-small-local-exec-tls \
12 ; RUN: -mtriple powerpc64-ibm-aix-xcoff -xcoff-traceback-table=false \
13 ; RUN: --code-model=large -filetype=obj -o %t.o < %s
14 ; RUN: llvm-objdump -D -r --symbol-description %t.o | FileCheck --check-prefix=DIS %s
16 @mySmallLocalExecTLSv1 = thread_local(localexec) global [8187 x i32] zeroinitializer, align 4
17 @mySmallLocalExecTLS2 = thread_local(localexec) global [4000 x i32] zeroinitializer, align 4
18 @mySmallLocalExecTLS3 = thread_local(localexec) global [4000 x i32] zeroinitializer, align 4
19 @mySmallLocalExecTLS4 = thread_local(localexec) global [4000 x i32] zeroinitializer, align 4
20 @mySmallLocalExecTLS5 = thread_local(localexec) global [4000 x i32] zeroinitializer, align 4
21 @mySmallLocalExecTLSv2 = thread_local(localexec) global [9000 x i32] zeroinitializer, align 4
22 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1
24 ; All accesses use a "faster" local-exec sequence directly off the thread pointer.
25 define signext i32 @StoreArrays1() {
26 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: StoreArrays1:
27 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
28 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r3, mySmallLocalExecTLSv1[TL]@le(r13)
29 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 1
30 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r5, 4
31 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r6, mySmallLocalExecTLS2[TL]@le(r13)
32 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r7, 2
33 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r4, mySmallLocalExecTLSv1[TL]@le(r13)
34 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r4, mySmallLocalExecTLS3[TL]@le(r13)
35 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r5, 24(r3)
36 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 3
37 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r7, 320(r6)
38 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r3, 324(r4)
39 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r4, mySmallLocalExecTLS4[TL]@le(r13)
40 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r6, mySmallLocalExecTLS5[TL]@le(r13)
41 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r7, 88
42 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 102
43 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r5, 328(r4)
44 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r7, 332(r6)
45 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
47 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: StoreArrays1:
48 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
49 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r3, mySmallLocalExecTLSv1[TL]@le(r13)
50 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r4, 1
51 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r5, 4
52 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r6, mySmallLocalExecTLS2[TL]@le(r13)
53 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r7, 2
54 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r4, mySmallLocalExecTLSv1[TL]@le(r13)
55 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r4, mySmallLocalExecTLS3[TL]@le(r13)
56 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r5, 24(r3)
57 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 3
58 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r7, 320(r6)
59 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r3, 324(r4)
60 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r4, mySmallLocalExecTLS4[TL]@le(r13)
61 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r6, mySmallLocalExecTLS5[TL]@le(r13)
62 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r7, 88
63 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 102
64 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r5, 328(r4)
65 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r7, 332(r6)
66 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
68 %0 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLSv1)
69 store i32 1, ptr %0, align 4
70 %arrayidx1 = getelementptr inbounds [8187 x i32], ptr %0, i64 0, i64 6
71 store i32 4, ptr %arrayidx1, align 4
72 %1 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS2)
73 %arrayidx2 = getelementptr inbounds [4000 x i32], ptr %1, i64 0, i64 80
74 store i32 2, ptr %arrayidx2, align 4
75 %2 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS3)
76 %arrayidx3 = getelementptr inbounds [4000 x i32], ptr %2, i64 0, i64 81
77 store i32 3, ptr %arrayidx3, align 4
78 %3 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS4)
79 %arrayidx4 = getelementptr inbounds [4000 x i32], ptr %3, i64 0, i64 82
80 store i32 4, ptr %arrayidx4, align 4
81 %4 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS5)
82 %arrayidx5 = getelementptr inbounds [4000 x i32], ptr %4, i64 0, i64 83
83 store i32 88, ptr %arrayidx5, align 4
84 %5 = load i32, ptr %0, align 4
85 %6 = load i32, ptr %arrayidx1, align 4
86 %7 = load i32, ptr %arrayidx2, align 4
87 %8 = load i32, ptr %arrayidx3, align 4
88 %9 = load i32, ptr %arrayidx4, align 4
90 %add9 = add i32 %add, %6
91 %add11 = add i32 %add9, %7
92 %add13 = add i32 %add11, %8
93 %add15 = add i32 %add13, %9
97 ; Example of one access using the regular local-exec access from the TOC.
98 define signext i32 @StoreArrays2() {
99 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: StoreArrays2:
100 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
101 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tprel) @mySmallLocalExecTLSv2
102 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 1
103 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r5, 4
104 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r6, mySmallLocalExecTLS2[TL]@le(r13)
105 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r7, 2
106 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: add r3, r13, r3
107 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r4, 0(r3)
108 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r4, mySmallLocalExecTLS3[TL]@le(r13)
109 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r5, 24(r3)
110 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 3
111 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r7, 320(r6)
112 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r3, 324(r4)
113 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r4, mySmallLocalExecTLS4[TL]@le(r13)
114 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: la r6, mySmallLocalExecTLS5[TL]@le(r13)
115 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r7, 88
116 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 102
117 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r5, 328(r4)
118 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stw r7, 332(r6)
119 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
121 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: StoreArrays2:
122 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
123 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r3, L..C0@u(r2)
124 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r4, 1
125 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r5, 4
126 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r6, mySmallLocalExecTLS2[TL]@le(r13)
127 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r7, 2
128 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r3, L..C0@l(r3)
129 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: add r3, r13, r3
130 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r4, 0(r3)
131 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r4, mySmallLocalExecTLS3[TL]@le(r13)
132 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r5, 24(r3)
133 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 3
134 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r7, 320(r6)
135 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r3, 324(r4)
136 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r4, mySmallLocalExecTLS4[TL]@le(r13)
137 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: la r6, mySmallLocalExecTLS5[TL]@le(r13)
138 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r7, 88
139 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 102
140 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r5, 328(r4)
141 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stw r7, 332(r6)
142 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
144 %0 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLSv2)
145 store i32 1, ptr %0, align 4
146 %arrayidx1 = getelementptr inbounds [9000 x i32], ptr %0, i64 0, i64 6
147 store i32 4, ptr %arrayidx1, align 4
148 %1 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS2)
149 %arrayidx2 = getelementptr inbounds [4000 x i32], ptr %1, i64 0, i64 80
150 store i32 2, ptr %arrayidx2, align 4
151 %2 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS3)
152 %arrayidx3 = getelementptr inbounds [4000 x i32], ptr %2, i64 0, i64 81
153 store i32 3, ptr %arrayidx3, align 4
154 %3 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS4)
155 %arrayidx4 = getelementptr inbounds [4000 x i32], ptr %3, i64 0, i64 82
156 store i32 4, ptr %arrayidx4, align 4
157 %4 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @mySmallLocalExecTLS5)
158 %arrayidx5 = getelementptr inbounds [4000 x i32], ptr %4, i64 0, i64 83
159 store i32 88, ptr %arrayidx5, align 4
160 %5 = load i32, ptr %0, align 4
161 %6 = load i32, ptr %arrayidx1, align 4
162 %7 = load i32, ptr %arrayidx2, align 4
163 %8 = load i32, ptr %arrayidx3, align 4
164 %9 = load i32, ptr %arrayidx4, align 4
165 %add = add i32 %5, 88
166 %add9 = add i32 %add, %6
167 %add11 = add i32 %add9, %7
168 %add13 = add i32 %add11, %8
169 %add15 = add i32 %add13, %9
173 ; DIS: {{.*}}aix-small-local-exec-tls-largeaccess.ll.tmp.o: file format aix5coff64-rs6000
174 ; DIS: Disassembly of section .text:
175 ; DIS: 0000000000000000 (idx: 3) .StoreArrays1:
176 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 3, 13, 0
177 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 15) mySmallLocalExecTLSv1[TL]
178 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 1
179 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 5, 4
180 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 6, 13, 32748
181 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 17) mySmallLocalExecTLS2[TL]
182 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 7, 2
183 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, 0(13)
184 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 15) mySmallLocalExecTLSv1[TL]
185 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 4, 13, -16788
186 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 19) mySmallLocalExecTLS3[TL]
187 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 24(3)
188 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 3
189 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 7, 320(6)
190 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, 324(4)
191 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 4, 13, -788
192 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 21) mySmallLocalExecTLS4[TL]
193 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 6, 13, 15212
194 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 23) mySmallLocalExecTLS5[TL]
195 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 7, 88
196 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 102
197 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 328(4)
198 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 7, 332(6)
199 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr
201 ; DIS: 0000000000000050 (idx: 5) .StoreArrays2:
202 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0
203 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: 13) mySmallLocalExecTLSv2[TE]
204 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 1
205 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 5, 4
206 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 6, 13, 32748
207 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 17) mySmallLocalExecTLS2[TL]
208 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 7, 2
209 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 0(3)
210 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: 13) mySmallLocalExecTLSv2[TE]
211 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} add 3, 13, 3
212 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 4, 0(3)
213 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 4, 13, -16788
214 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 19) mySmallLocalExecTLS3[TL]
215 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 24(3)
216 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 3
217 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 7, 320(6)
218 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 3, 324(4)
219 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 4, 13, -788
220 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 21) mySmallLocalExecTLS4[TL]
221 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 6, 13, 15212
222 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: 23) mySmallLocalExecTLS5[TL]
223 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 7, 88
224 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 102
225 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 5, 328(4)
226 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stw 7, 332(6)
227 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr
229 ; DIS: Disassembly of section .data:
230 ; DIS: 00000000000000a0 (idx: 7) StoreArrays1[DS]:
231 ; DIS-NEXT: a0: 00 00 00 00
232 ; DIS-NEXT: 00000000000000a0: R_POS (idx: 3) .StoreArrays1
233 ; DIS-NEXT: a4: 00 00 00 00
234 ; DIS-NEXT: a8: 00 00 00 00
235 ; DIS-NEXT: 00000000000000a8: R_POS (idx: 11) TOC[TC0]
236 ; DIS-NEXT: ac: 00 00 00 d0
238 ; DIS: 00000000000000b8 (idx: 9) StoreArrays2[DS]:
239 ; DIS-NEXT: b8: 00 00 00 00
240 ; DIS-NEXT: 00000000000000b8: R_POS (idx: 5) .StoreArrays2
241 ; DIS-NEXT: bc: 00 00 00 50
242 ; DIS-NEXT: c0: 00 00 00 00
243 ; DIS-NEXT: 00000000000000c0: R_POS (idx: 11) TOC[TC0]
244 ; DIS-NEXT: c4: 00 00 00 d0
246 ; DIS: 00000000000000d0 (idx: 13) mySmallLocalExecTLSv2[TE]:
247 ; DIS-NEXT: d0: 00 00 00 00
248 ; DIS-NEXT: 00000000000000d0: R_TLS_LE (idx: 25) mySmallLocalExecTLSv2[TL]
249 ; DIS-NEXT: d4: 00 01 79 ec