[llvm] [AIX][TLS] Produce a faster local-exec access sequence for the "aix-small-tls" global variable attribute (PR #83053)
Felix via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 06:59:05 PDT 2024
================
@@ -0,0 +1,103 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
+; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
+; RUN: -mtriple powerpc64-ibm-aix-xcoff -mattr=+aix-small-local-exec-tls < %s \
+; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-EXEC-SMALLCM64
+; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \
+; RUN: -mtriple powerpc64-ibm-aix-xcoff --code-model=large \
+; RUN: -mattr=+aix-small-local-exec-tls < %s | FileCheck %s \
+; RUN: --check-prefix=SMALL-LOCAL-EXEC-LARGECM64
+
+ at mySmallLocalExecTLS6 = external thread_local(localexec) global [60 x i64], align 8
+ at mySmallLocalExecTLS2 = external thread_local(localexec) global [3000 x i64], align 8 #0
+ at MyTLSGDVar = thread_local global [800 x i64] zeroinitializer, align 8
+ at mySmallLocalExecTLS3 = internal thread_local(localexec) global [3000 x i64] zeroinitializer, align 8
+ at mySmallLocalExecTLS4 = internal thread_local(localexec) global [3000 x i64] zeroinitializer, align 8 #0
+ at mySmallLocalExecTLS5 = thread_local(localexec) global [3000 x i64] zeroinitializer, align 8 #0
+declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)
+
+; Although some global variables are annotated with 'aix-small-tls', because the
+; aix-small-local-exec-tls target attribute is turned on, all accesses will use
+; a "faster" local-exec sequence directly off the thread pointer.
+define i64 @StoreLargeAccess1() {
----------------
orcguru wrote:
Trivial comment:
Maybe update this case to
define i64 @StoreLargeAccess1() {
entry:
%tls0 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS6)
%arrayidx = getelementptr inbounds [60 x i64], ptr %tls0, i64 0, i64 53
store i64 212, ptr %arrayidx, align 8
%tls1 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS2)
%arrayidx1 = getelementptr inbounds [3000 x i64], ptr %tls1, i64 0, i64 150
store i64 203, ptr %arrayidx1, align 8
%tls2 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @MyTLSGDVar)
%arrayidx2 = getelementptr inbounds [800 x i64], ptr %tls2, i64 0, i64 55
store i64 44, ptr %arrayidx2, align 8
%tls3 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS3)
%arrayidx3 = getelementptr inbounds [3000 x i64], ptr %tls3, i64 0, i64 250
store i64 6, ptr %arrayidx3, align 8
%tls4 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS4)
%arrayidx4 = getelementptr inbounds [3000 x i64], ptr %tls4, i64 0, i64 850
store i64 100, ptr %arrayidx4, align 8
%tls5 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mySmallLocalExecTLS5)
%arrayidx5 = getelementptr inbounds [3000 x i64], ptr %tls5, i64 0, i64 1050
store i64 882, ptr %arrayidx5, align 8
%load1 = load i64, ptr %arrayidx1, align 8
%load2 = load i64, ptr %arrayidx3, align 8
%load3 = load i64, ptr %arrayidx4, align 8
%add = add i64 %load1, 882
%add9 = add i64 %add, %load2
%add11 = add i64 %add9, %load3
ret i64 %add11
}
https://github.com/llvm/llvm-project/pull/83053
More information about the llvm-commits
mailing list