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 -D#NFA=2 --check-prefix=DIS %s
16 @mySmallLocalExecTLS6 = external thread_local(localexec) global [60 x i64], align 8
17 @mySmallLocalExecTLS2 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
18 @MyTLSGDVar = thread_local global [800 x i64] zeroinitializer, align 8
19 @mySmallLocalExecTLS3 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
20 @mySmallLocalExecTLS4 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
21 @mySmallLocalExecTLS5 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
22 @mySmallLocalExecTLS = thread_local(localexec) local_unnamed_addr global [7800 x i64] zeroinitializer, align 8
23 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1
25 ; All accesses use a "faster" local-exec sequence directly off the thread pointer.
26 define i64 @StoreLargeAccess1() {
27 ; SMALL-LOCAL-EXEC-SMALLCM64-LABEL: StoreLargeAccess1:
28 ; SMALL-LOCAL-EXEC-SMALLCM64: # %bb.0: # %entry
29 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: mflr r0
30 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: stdu r1, -48(r1)
31 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 212
32 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 203
33 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r0, 64(r1)
34 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r3, mySmallLocalExecTLS6[UL]@le+424(r13)
35 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r4, mySmallLocalExecTLS2[TL]@le+1200(r13)
36 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsgdm) @MyTLSGDVar
37 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsgd) @MyTLSGDVar
38 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: bla .__tls_get_addr[PR]
39 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 44
40 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r4, 440(r3)
41 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 6
42 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 100
43 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r3, mySmallLocalExecTLS3[TL]@le+2000(r13)
44 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 882
45 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r4, (mySmallLocalExecTLS4[TL]@le+6800)-65536(r13)
46 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: std r3, (mySmallLocalExecTLS5[TL]@le+8400)-65536(r13)
47 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r3, 1191
48 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: addi r1, r1, 48
49 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: ld r0, 16(r1)
50 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: mtlr r0
51 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: blr
53 ; SMALL-LOCAL-EXEC-LARGECM64-LABEL: StoreLargeAccess1:
54 ; SMALL-LOCAL-EXEC-LARGECM64: # %bb.0: # %entry
55 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: mflr r0
56 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: stdu r1, -48(r1)
57 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 212
58 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r0, 64(r1)
59 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r4, L..C0@u(r2)
60 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r4, L..C0@l(r4)
61 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r3, mySmallLocalExecTLS6[UL]@le+424(r13)
62 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 203
63 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r3, mySmallLocalExecTLS2[TL]@le+1200(r13)
64 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addis r3, L..C1@u(r2)
65 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r3, L..C1@l(r3)
66 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: bla .__tls_get_addr[PR]
67 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r4, 44
68 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r4, 440(r3)
69 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 6
70 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r4, 100
71 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r3, mySmallLocalExecTLS3[TL]@le+2000(r13)
72 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 882
73 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r4, (mySmallLocalExecTLS4[TL]@le+6800)-65536(r13)
74 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: std r3, (mySmallLocalExecTLS5[TL]@le+8400)-65536(r13)
75 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r3, 1191
76 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: addi r1, r1, 48
77 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r0, 16(r1)
78 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: mtlr r0
79 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: blr
81 %0 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS6)
82 %arrayidx = getelementptr inbounds [60 x i64], ptr %0, i64 0, i64 53
83 store i64 212, ptr %arrayidx, align 8
84 %1 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS2)
85 %arrayidx1 = getelementptr inbounds [3000 x i64], ptr %1, i64 0, i64 150
86 store i64 203, ptr %arrayidx1, align 8
87 %2 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @MyTLSGDVar)
88 %arrayidx2 = getelementptr inbounds [800 x i64], ptr %2, i64 0, i64 55
89 store i64 44, ptr %arrayidx2, align 8
90 %3 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS3)
91 %arrayidx3 = getelementptr inbounds [3000 x i64], ptr %3, i64 0, i64 250
92 store i64 6, ptr %arrayidx3, align 8
93 %4 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS4)
94 %arrayidx4 = getelementptr inbounds [3000 x i64], ptr %4, i64 0, i64 850
95 store i64 100, ptr %arrayidx4, align 8
96 %5 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS5)
97 %arrayidx5 = getelementptr inbounds [3000 x i64], ptr %5, i64 0, i64 1050
98 store i64 882, ptr %arrayidx5, align 8
99 %6 = load i64, ptr %arrayidx1, align 8
100 %7 = load i64, ptr %arrayidx3, align 8
101 %8 = load i64, ptr %arrayidx4, align 8
102 %add = add i64 %6, 882
103 %add9 = add i64 %add, %7
104 %add11 = add i64 %add9, %8
108 ; DIS: 0000000000000000 (idx: [[#NFA+7]]) .StoreLargeAccess1:
109 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} mflr 0
110 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} stdu 1, -48(1)
111 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 212
112 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 0, 64(1)
113 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 4, 2, 0
114 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+13]]) MyTLSGDVar[TE]
115 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 4, 0(4)
116 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+13]]) MyTLSGDVar[TE]
117 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 424(13)
118 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+1]]) mySmallLocalExecTLS6[UL]
119 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 203
120 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 1200(13)
121 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL]
122 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addis 3, 2, 0
123 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCU (idx: [[#NFA+15]]) .MyTLSGDVar[TE]
124 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 3, 8(3)
125 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TOCL (idx: [[#NFA+15]]) .MyTLSGDVar[TE]
126 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} bla 0
127 ; DIS-NEXT: {{0*}}[[#ADDR]]: R_RBA (idx: [[#NFA+3]]) .__tls_get_addr[PR]
128 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 44
129 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 4, 440(3)
130 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 6
131 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 4, 100
132 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 32400(13)
133 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+21]]) mySmallLocalExecTLS3[TL]
134 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 882
135 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 4, -4336(13)
136 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+23]]) mySmallLocalExecTLS4[TL]
137 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} std 3, 21264(13)
138 ; DIS-NEXT: {{0*}}[[#ADDR + 2]]: R_TLS_LE (idx: [[#NFA+25]]) mySmallLocalExecTLS5[TL]
139 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} li 3, 1191
140 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} addi 1, 1, 48
141 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} ld 0, 16(1)
142 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} mtlr 0
143 ; DIS-NEXT: [[#%x, ADDR:]]: {{.*}} blr
145 ; DIS: Disassembly of section .data:
146 ; DIS: 0000000000000068 (idx: [[#NFA+9]]) StoreLargeAccess1[DS]:
147 ; DIS-NEXT: 68: 00 00 00 00
148 ; DIS-NEXT: 0000000000000068: R_POS (idx: [[#NFA+7]]) .StoreLargeAccess1
149 ; DIS-NEXT: 6c: 00 00 00 00
150 ; DIS-NEXT: 70: 00 00 00 00
151 ; DIS-NEXT: 0000000000000070: R_POS (idx: [[#NFA+11]]) TOC[TC0]
152 ; DIS-NEXT: 74: 00 00 00 80
154 ; DIS: Disassembly of section .tdata:
155 ; DIS: 0000000000000000 (idx: [[#NFA+17]]) mySmallLocalExecTLS2[TL]:
156 ; DIS: 0000000000005dc0 (idx: [[#NFA+19]]) MyTLSGDVar[TL]:
157 ; DIS: 00000000000076c0 (idx: [[#NFA+21]]) mySmallLocalExecTLS3[TL]:
158 ; DIS: 000000000000d480 (idx: [[#NFA+23]]) mySmallLocalExecTLS4[TL]:
159 ; DIS: 0000000000013240 (idx: [[#NFA+25]]) mySmallLocalExecTLS5[TL]:
160 ; DIS: 0000000000019000 (idx: [[#NFA+27]]) mySmallLocalExecTLS[TL]: