1 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
2 ; RUN: -mtriple powerpc64-ibm-aix-xcoff -mattr=+aix-small-local-exec-tls < %s \
3 ; RUN: | FileCheck %s --check-prefixes=COMMONCM,SMALL-LOCAL-EXEC-SMALLCM64
4 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
5 ; RUN: -mtriple powerpc64-ibm-aix-xcoff --code-model=large \
6 ; RUN: -mattr=+aix-small-local-exec-tls < %s | FileCheck %s \
7 ; RUN: --check-prefixes=COMMONCM,SMALL-LOCAL-EXEC-LARGECM64
9 @mySmallTLS = thread_local(localexec) global [7800 x i64] zeroinitializer, align 8 #0
10 @mySmallTLS2 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8 #0
11 @mySmallTLS3 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
12 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)
14 ; Although some global variables are annotated with 'aix-small-tls', because the
15 ; aix-small-local-exec-tls target attribute is turned on, all accesses will use
16 ; a "faster" local-exec sequence directly off the thread pointer.
17 define i64 @StoreLargeAccess1() {
18 ; COMMONCM-LABEL: StoreLargeAccess1:
19 ; COMMONCM-NEXT: # %bb.0: # %entry
20 ; SMALL-LOCAL-EXEC-SMALLCM64: ld r3, L..C0(r2) # target-flags(ppc-tprel) @mySmallTLS
21 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r4, 0
22 ; SMALL-LOCAL-EXEC-SMALLCM64-NEXT: li r5, 23
23 ; SMALL-LOCAL-EXEC-LARGECM64: addis r3, L..C0@u(r2)
24 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r4, 0
25 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: li r5, 23
26 ; SMALL-LOCAL-EXEC-LARGECM64-NEXT: ld r3, L..C0@l(r3)
27 ; COMMONCM: ori r4, r4, 53328
28 ; COMMONCM-NEXT: add r3, r13, r3
29 ; COMMONCM-NEXT: stdx r5, r3, r4
30 ; COMMONCM-NEXT: li r3, 55
31 ; COMMONCM-NEXT: li r4, 64
32 ; COMMONCM-NEXT: std r3, (mySmallTLS2[TL]@le+696)-65536(r13)
33 ; COMMONCM-NEXT: li r3, 142
34 ; COMMONCM-NEXT: std r4, (mySmallTLS3[TL]@le+20000)-131072(r13)
37 %tls0 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallTLS)
38 %arrayidx = getelementptr inbounds i8, ptr %tls0, i32 53328
39 store i64 23, ptr %arrayidx, align 8
40 %tls1 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallTLS2)
41 %arrayidx1 = getelementptr inbounds i8, ptr %tls1, i32 696
42 store i64 55, ptr %arrayidx1, align 8
43 %tls2 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallTLS3)
44 %arrayidx2 = getelementptr inbounds i8, ptr %tls2, i32 20000
45 store i64 64, ptr %arrayidx2, align 8
46 %load1 = load i64, ptr %arrayidx, align 8
47 %load2 = load i64, ptr %arrayidx1, align 8
48 %add1 = add i64 %load1, 64
49 %add2 = add i64 %add1, %load2
53 attributes #0 = { "aix-small-tls" }