diff options
author | Felix (Ting Wang) <Ting.Wang.SH@ibm.com> | 2024-04-12 08:18:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 08:18:01 +0800 |
commit | 09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0 (patch) | |
tree | 8fd744c659f86c435238aba0e6047a085687426d | |
parent | bf1d7b8df287d69ee265b91be40dec37267b2d5c (diff) | |
download | llvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.zip llvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.tar.gz llvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.tar.bz2 |
[PowerPC][AIX] Enable aix-small-local-dynamic-tls target attribute (#86641)
Following the aix-small-local-exec-tls target attribute, this patch adds
a target attribute for an AIX-specific option in llc that informs the
compiler that it can use a faster access sequence for the local-dynamic
TLS model (formally named aix-small-local-dynamic-tls) when TLS
variables are less than ~32KB in size.
The patch either produces an addi/la with a displacement off of module
handle (return value from .__tls_get_mod) when the address is
calculated, or it produces an addi/la followed by a load/store when the
address is calculated and used for further accesses.
---------
Co-authored-by: Amy Kwan <amy.kwan1@ibm.com>
10 files changed, 1530 insertions, 396 deletions
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp index f4998e9..714ce64 100644 --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp @@ -71,6 +71,8 @@ std::pair<uint8_t, uint8_t> PPCXCOFFObjectWriter::getRelocTypeAndSignSize( return {XCOFF::RelocationType::R_TOCL, SignAndSizeForHalf16}; case MCSymbolRefExpr::VK_PPC_AIX_TLSLE: return {XCOFF::RelocationType::R_TLS_LE, SignAndSizeForHalf16}; + case MCSymbolRefExpr::VK_PPC_AIX_TLSLD: + return {XCOFF::RelocationType::R_TLS_LD, SignAndSizeForHalf16}; } } break; case PPC::fixup_ppc_half16ds: @@ -86,6 +88,8 @@ std::pair<uint8_t, uint8_t> PPCXCOFFObjectWriter::getRelocTypeAndSignSize( return {XCOFF::RelocationType::R_TOCL, 15}; case MCSymbolRefExpr::VK_PPC_AIX_TLSLE: return {XCOFF::RelocationType::R_TLS_LE, 15}; + case MCSymbolRefExpr::VK_PPC_AIX_TLSLD: + return {XCOFF::RelocationType::R_TLS_LD, 15}; } } break; case PPC::fixup_ppc_br24: diff --git a/llvm/lib/Target/PowerPC/PPC.td b/llvm/lib/Target/PowerPC/PPC.td index 535616d..b962ed2 100644 --- a/llvm/lib/Target/PowerPC/PPC.td +++ b/llvm/lib/Target/PowerPC/PPC.td @@ -329,6 +329,15 @@ def FeatureAIXLocalExecTLS : "Produce a TOC-free local-exec TLS sequence for this function " "for 64-bit AIX">; +// Specifies that local-dynamic TLS accesses in any function with this target +// attribute should use the optimized sequence (where the offset is an immediate +// off the module-handle for which the linker might add fix-up code for if the +// immediate is too large). +def FeatureAIXLocalDynamicTLS : + SubtargetFeature<"aix-small-local-dynamic-tls", "HasAIXSmallLocalDynamicTLS", + "true", "Produce a faster local-dynamic TLS sequence for this " + "function for 64-bit AIX">; + def FeaturePredictableSelectIsExpensive : SubtargetFeature<"predictable-select-expensive", "PredictableSelectIsExpensive", diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index 16942c6..1c57b92 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -803,7 +803,8 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) { MCInst TmpInst; const bool IsPPC64 = Subtarget->isPPC64(); const bool IsAIX = Subtarget->isAIXABI(); - const bool HasAIXSmallLocalExecTLS = Subtarget->hasAIXSmallLocalExecTLS(); + const bool HasAIXSmallLocalTLS = Subtarget->hasAIXSmallLocalExecTLS() || + Subtarget->hasAIXSmallLocalDynamicTLS(); const Module *M = MF->getFunction().getParent(); PICLevel::Level PL = M->getPICLevel(); @@ -1612,11 +1613,11 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) { case PPC::LFD: case PPC::STFD: case PPC::ADDI8: { - // A faster non-TOC-based local-exec sequence is represented by `addi` - // or a load/store instruction (that directly loads or stores off of the - // thread pointer) with an immediate operand having the MO_TPREL_FLAG. + // A faster non-TOC-based local-[exec|dynamic] sequence is represented by + // `addi` or a load/store instruction (that directly loads or stores off of + // the thread pointer) with an immediate operand having the MO_TPREL_FLAG. // Such instructions do not otherwise arise. - if (!HasAIXSmallLocalExecTLS) + if (!HasAIXSmallLocalTLS) break; bool IsMIADDI8 = MI->getOpcode() == PPC::ADDI8; unsigned OpNum = IsMIADDI8 ? 2 : 1; @@ -1624,7 +1625,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) { unsigned Flag = MO.getTargetFlags(); if (Flag == PPCII::MO_TPREL_FLAG || Flag == PPCII::MO_GOT_TPREL_PCREL_FLAG || - Flag == PPCII::MO_TPREL_PCREL_FLAG) { + Flag == PPCII::MO_TPREL_PCREL_FLAG || Flag == PPCII::MO_TLSLD_FLAG) { LowerPPCMachineInstrToMCInst(MI, TmpInst, *this); const MCExpr *Expr = getAdjustedLocalExecExpr(MO, MO.getOffset()); @@ -1672,7 +1673,12 @@ const MCExpr *PPCAsmPrinter::getAdjustedLocalExecExpr(const MachineOperand &MO, assert(MO.isGlobal() && "Only expecting a global MachineOperand here!"); const GlobalValue *GValue = MO.getGlobal(); - assert(TM.getTLSModel(GValue) == TLSModel::LocalExec && + // TODO: Handle the aix-small-local-dynamic-tls non-zero offset case. + TLSModel::Model Model = TM.getTLSModel(GValue); + if (Model == TLSModel::LocalDynamic) { + return nullptr; + } + assert(Model == TLSModel::LocalExec && "Only local-exec accesses are handled!"); bool IsGlobalADeclaration = GValue->isDeclarationForLinker(); diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 52d5b71..d27932f 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -153,10 +153,10 @@ static SDValue widenVec(SelectionDAG &DAG, SDValue Vec, const SDLoc &dl); static const char AIXSSPCanaryWordName[] = "__ssp_canary_word"; -// A faster local-exec TLS access sequence (enabled with the -// -maix-small-local-exec-tls option) can be produced for TLS variables; -// consistent with the IBM XL compiler, we apply a max size of slightly under -// 32KB. +// A faster local-[exec|dynamic] TLS access sequence (enabled with the +// -maix-small-local-[exec|dynamic]-tls option) can be produced for TLS +// variables; consistent with the IBM XL compiler, we apply a max size of +// slightly under 32KB. constexpr uint64_t AIXSmallTlsPolicySizeLimit = 32751; // FIXME: Remove this once the bug has been fixed! @@ -3434,6 +3434,14 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddressAIX(SDValue Op, } if (Model == TLSModel::LocalDynamic) { + bool HasAIXSmallLocalDynamicTLS = Subtarget.hasAIXSmallLocalDynamicTLS(); + + // We do not implement the 32-bit version of the faster access sequence + // for local-dynamic that is controlled by -maix-small-local-dynamic-tls. + if (!Is64Bit && HasAIXSmallLocalDynamicTLS) + report_fatal_error("The small-local-dynamic TLS access sequence is " + "currently only supported on AIX (64-bit mode)."); + // For local-dynamic on AIX, we need to generate one TOC entry for each // variable offset, and a single module-handle TOC entry for the entire // file. @@ -3454,6 +3462,22 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddressAIX(SDValue Op, SDValue ModuleHandle = DAG.getNode(PPCISD::TLSLD_AIX, dl, PtrVT, ModuleHandleTOC); + // With the -maix-small-local-dynamic-tls option, produce a faster access + // sequence for local-dynamic TLS variables where the offset from the + // module-handle is encoded as an immediate operand. + // + // We only utilize the faster local-dynamic access sequence when the TLS + // variable has a size within the policy limit. We treat types that are + // not sized or are empty as being over the policy size limit. + if (HasAIXSmallLocalDynamicTLS) { + Type *GVType = GV->getValueType(); + if (GVType->isSized() && !GVType->isEmptyTy() && + GV->getParent()->getDataLayout().getTypeAllocSize(GVType) <= + AIXSmallTlsPolicySizeLimit) + return DAG.getNode(PPCISD::Lo, dl, PtrVT, VariableOffsetTGA, + ModuleHandle); + } + return DAG.getNode(ISD::ADD, dl, PtrVT, ModuleHandle, VariableOffset); } diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp index 9a3ca5a..c05bb37 100644 --- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -96,15 +96,18 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, RefKind = MCSymbolRefExpr::VK_PPC_GOT_TLSLD_PCREL; else if (MO.getTargetFlags() == PPCII::MO_GOT_TPREL_PCREL_FLAG) RefKind = MCSymbolRefExpr::VK_PPC_GOT_TPREL_PCREL; - else if (MO.getTargetFlags() == PPCII::MO_TPREL_FLAG) { + else if (MO.getTargetFlags() == PPCII::MO_TPREL_FLAG || + MO.getTargetFlags() == PPCII::MO_TLSLD_FLAG) { assert(MO.isGlobal() && "Only expecting a global MachineOperand here!"); TLSModel::Model Model = TM.getTLSModel(MO.getGlobal()); - // For the local-exec TLS model, we may generate the offset from the TLS - // base as an immediate operand (instead of using a TOC entry). - // Set the relocation type in case the result is used for purposes other - // than a TOC reference. In TOC reference cases, this result is discarded. + // For the local-[exec|dynamic] TLS model, we may generate the offset from + // the TLS base as an immediate operand (instead of using a TOC entry). Set + // the relocation type in case the result is used for purposes other than a + // TOC reference. In TOC reference cases, this result is discarded. if (Model == TLSModel::LocalExec) RefKind = MCSymbolRefExpr::VK_PPC_AIX_TLSLE; + else if (Model == TLSModel::LocalDynamic) + RefKind = MCSymbolRefExpr::VK_PPC_AIX_TLSLD; } const MachineInstr *MI = MO.getParent(); diff --git a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp index 653d9bd..d172255 100644 --- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp @@ -124,22 +124,22 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU, // Determine endianness. IsLittleEndian = TM.isLittleEndian(); - if (HasAIXSmallLocalExecTLS) { + if (HasAIXSmallLocalExecTLS || HasAIXSmallLocalDynamicTLS) { if (!TargetTriple.isOSAIX() || !IsPPC64) - report_fatal_error( - "The aix-small-local-exec-tls attribute is only supported on AIX in " - "64-bit mode.\n", - false); - // The aix-small-local-exec-tls attribute should only be used with + report_fatal_error("The aix-small-local-[exec|dynamic]-tls attribute is " + "only supported on AIX in " + "64-bit mode.\n", + false); + // The aix-small-local-[exec|dynamic]-tls attribute should only be used with // -data-sections, as having data sections turned off with this option - // is not ideal for performance. Moreover, the small-local-exec-tls region - // is a limited resource, and should not be used for variables that may - // be replaced. + // is not ideal for performance. Moreover, the + // small-local-[exec|dynamic]-tls region is a limited resource, and should + // not be used for variables that may be replaced. if (!TM.getDataSections()) - report_fatal_error( - "The aix-small-local-exec-tls attribute can only be specified with " - "-data-sections.\n", - false); + report_fatal_error("The aix-small-local-[exec|dynamic]-tls attribute can " + "only be specified with " + "-data-sections.\n", + false); } } diff --git a/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-largeaccess.ll b/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-largeaccess.ll index eb16bae..7db1048 100644 --- a/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-largeaccess.ll +++ b/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-largeaccess.ll @@ -1,9 +1,9 @@ ; 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 < %s \ +; RUN: -mattr=+aix-small-local-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff < %s \ ; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-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-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff --code-model=large \ ; RUN: < %s | FileCheck %s \ ; RUN: --check-prefix=SMALL-LOCAL-DYNAMIC-LARGECM64 @@ -39,27 +39,23 @@ define signext i32 @test1() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r6, L..C1(r2) # target-flags(ppc-tlsld) @ElementIntTLS2 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r7, L..C2(r2) # target-flags(ppc-tlsld) @ElementIntTLS3 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r8, L..C3(r2) # target-flags(ppc-tlsld) @ElementIntTLS4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r9, L..C4(r2) # target-flags(ppc-tlsld) @ElementIntTLS5 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r6, 4 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r5, L..C5(r2) # target-flags(ppc-tlsld) @ElementIntTLSv1 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 1 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r6, r3, r6 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r7, r3, r7 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r8, r3, r8 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r9, r3, r9 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stwux r4, r3, r5 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 24(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 2 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 320(r6) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 3 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 324(r7) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 88 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 328(r8) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 332(r9) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r5, 1 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r4, ElementIntTLSv1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r5, ElementIntTLSv1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r5, ElementIntTLS2[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r6, 24(r4) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 2 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 320(r5) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r4, ElementIntTLS3[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r5, 3 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r5, 324(r4) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r4, ElementIntTLS4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementIntTLS5[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r6, 328(r4) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 88 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 332(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 102 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) @@ -71,34 +67,25 @@ define signext i32 @test1() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C1@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C2@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r6, 4 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r8, L..C3@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r9, L..C4@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r7, L..C2@l(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r8, L..C3@l(r8) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r9, L..C4@l(r9) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r5, L..C1@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C5@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 1 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r6, L..C5@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r7, r3, r7 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r8, r3, r8 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r9, r3, r9 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r6, r3, r6 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stwux r4, r3, r5 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 4 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r4, 24(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 2 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 320(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 3 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 324(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 88 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r4, 328(r8) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 332(r9) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r5, 1 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r4, ElementIntTLSv1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r5, ElementIntTLSv1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r5, ElementIntTLS2[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r6, 24(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 2 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r4, 320(r5) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r4, ElementIntTLS3[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r5, 3 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r5, 324(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r4, ElementIntTLS4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementIntTLS5[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r6, 328(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 88 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r4, 332(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 102 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) @@ -144,31 +131,26 @@ define i64 @test2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C6(r2) # target-flags(ppc-tlsld) @ElementLongTLS6 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mr r6, r3 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 212 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r4, r6, r4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r3, 424(r4) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C7(r2) # target-flags(ppc-tlsld) @ElementLongTLS2 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementLongTLS6[UL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 212 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 424(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementLongTLS2[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 203 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 1200(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C8(r2) # target-flags(ppc-tlsgdm) @MyTLSGDVar -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsgd) @MyTLSGDVar +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C1(r2) # target-flags(ppc-tlsgdm) @MyTLSGDVar +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C2(r2) # target-flags(ppc-tlsgd) @MyTLSGDVar ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_addr[PR] ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 44 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 440(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C10(r2) # target-flags(ppc-tlsld) @ElementLongTLS3 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementLongTLS3[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 6 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 2000(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @ElementLongTLS4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 100 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r4, r6, r4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r3, 6800(r4) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C12(r2) # target-flags(ppc-tlsld) @ElementLongTLS5 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementLongTLS4[TL]@ld(r6) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 100 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 6800(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ElementLongTLS5[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 882 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, 8400(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 1191 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 @@ -182,40 +164,30 @@ define i64 @test2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C6@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 212 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mr r6, r3 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C6@l(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r6, r3 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementLongTLS6[UL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 424(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C7@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementLongTLS2[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 203 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C7@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 1200(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C8@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r4, L..C9@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C8@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C9@l(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C1@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r4, L..C2@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C2@l(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_addr[PR] ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 44 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 440(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C10@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementLongTLS3[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 6 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C10@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 2000(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C11@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementLongTLS4[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 100 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C11@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 6800(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C12@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ElementLongTLS5[TL]@ld(r6) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 882 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C12@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, 8400(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 1191 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 @@ -257,27 +229,23 @@ define signext i32 @test3() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r8, L..C3(r2) # target-flags(ppc-tlsld) @ElementIntTLSv2 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r6, L..C1(r2) # target-flags(ppc-tlsld) @ElementIntTLS2 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r7, L..C2(r2) # target-flags(ppc-tlsld) @ElementIntTLS3 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r8, L..C3(r2) # target-flags(ppc-tlsld) @ElementIntTLS4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r9, L..C4(r2) # target-flags(ppc-tlsld) @ElementIntTLS5 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r5, L..C13(r2) # target-flags(ppc-tlsld) @ElementIntTLSv2 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 1 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r6, r3, r6 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r7, r3, r7 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r8, r3, r8 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r9, r3, r9 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stwux r4, r3, r5 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r5, ElementIntTLS2[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r6, ElementIntTLS3[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r7, ElementIntTLS4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r9, ElementIntTLS5[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stwux r4, r3, r8 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r4, 4 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 24(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 2 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 320(r6) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 320(r5) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 3 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 324(r7) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 324(r6) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 88 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 328(r8) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r4, 328(r7) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stw r3, 332(r9) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: li r3, 102 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 @@ -290,29 +258,21 @@ define signext i32 @test3() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C13@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C3@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C2@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r8, L..C3@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r9, L..C4@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r7, L..C2@l(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r8, L..C3@l(r8) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r9, L..C4@l(r9) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r6, L..C3@l(r6) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r5, L..C13@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C5@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 1 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r6, L..C5@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r7, r3, r7 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r8, r3, r8 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r9, r3, r9 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r6, r3, r6 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stwux r4, r3, r5 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r5, ElementIntTLS2[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r7, ElementIntTLS3[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r8, ElementIntTLS4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r9, ElementIntTLS5[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stwux r4, r3, r6 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r4, 4 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r4, 24(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 2 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 320(r6) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 320(r5) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stw r3, 324(r7) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: li r3, 88 diff --git a/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-types.ll b/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-types.ll index d996d86..161a58a 100644 --- a/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-types.ll +++ b/llvm/test/CodeGen/PowerPC/aix-small-local-dynamic-tls-types.ll @@ -1,18 +1,30 @@ ; 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 < %s \ +; RUN: -mattr=+aix-small-local-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff < %s \ ; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-SMALLCM64 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ +; RUN: -mattr=+aix-small-local-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff --code-model=large \ +; RUN: < %s | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-LARGECM64 +; RUN: llc -O0 -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ +; RUN: -mattr=+aix-small-local-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff < %s \ +; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-SMALLCM64-O0 +; RUN: llc -O0 -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ +; RUN: -mattr=+aix-small-local-dynamic-tls -mtriple powerpc64-ibm-aix-xcoff --code-model=large \ +; RUN: < %s | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-LARGECM64-O0 +; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ +; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s \ +; RUN: | FileCheck %s --check-prefix=DEFAULT-LOCAL-DYNAMIC-SMALLCM64 +; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff --code-model=large \ ; RUN: < %s | FileCheck %s \ -; RUN: --check-prefix=SMALL-LOCAL-DYNAMIC-LARGECM64 +; RUN: --check-prefix=DEFAULT-LOCAL-DYNAMIC-LARGECM64 ; RUN: llc -O0 -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s \ -; RUN: | FileCheck %s --check-prefix=SMALL-LOCAL-DYNAMIC-SMALLCM64-O0 +; RUN: | FileCheck %s --check-prefix=DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0 ; RUN: llc -O0 -verify-machineinstrs -mcpu=pwr7 -ppc-asm-full-reg-names \ ; RUN: -mtriple powerpc64-ibm-aix-xcoff --code-model=large \ ; RUN: < %s | FileCheck %s \ -; RUN: --check-prefix=SMALL-LOCAL-DYNAMIC-LARGECM64-O0 +; RUN: --check-prefix=DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1 @tlv_int_init = local_unnamed_addr global i32 87, align 4 @@ -27,7 +39,8 @@ declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1 @internal_tlv_double = internal thread_local(localdynamic) global double 1.000000e+00, align 8 %struct.anon = type { i32 } -@ThreadLocalStruct = thread_local(localdynamic) global %struct.anon zeroinitializer, align 1 +@ThreadLocalStructAlign1 = thread_local(localdynamic) global %struct.anon zeroinitializer, align 1 +@ThreadLocalStructAlign4 = thread_local(localdynamic) global %struct.anon zeroinitializer, align 4 @a = thread_local(localdynamic) global [87 x i32] zeroinitializer, align 4 define nonnull ptr @AddrTest1() local_unnamed_addr { @@ -38,8 +51,7 @@ define nonnull ptr @AddrTest1() local_unnamed_addr { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, a[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r3, 12 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) @@ -51,12 +63,10 @@ define nonnull ptr @AddrTest1() local_unnamed_addr { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C1@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C1@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, a[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r3, 12 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) @@ -70,8 +80,7 @@ define nonnull ptr @AddrTest1() local_unnamed_addr { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, a[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r3, 12 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -81,27 +90,212 @@ define nonnull ptr @AddrTest1() local_unnamed_addr { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: AddrTest1: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C0@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, a[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r3, 12 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: AddrTest1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r3, 12 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: AddrTest1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C1@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r3, 12 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: AddrTest1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r3, 12 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: AddrTest1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C0@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r3, 12 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @a) %arrayidx = getelementptr inbounds [87 x i32], ptr %tlv_addr, i64 0, i64 3 ret ptr %arrayidx } +; Demonstrates when offset is zero, addi for the offset is optimized out. +define nonnull ptr @AddrTest2() local_unnamed_addr { +; SMALL-LOCAL-DYNAMIC-SMALLCM64-LABEL: AddrTest2: +; SMALL-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, a[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-LARGECM64-LABEL: AddrTest2: +; SMALL-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, a[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: AddrTest2: +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, a[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: AddrTest2: +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, a[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: AddrTest2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: AddrTest2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C1@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: AddrTest2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C1(r2) # target-flags(ppc-tlsld) @a +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: AddrTest2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C0@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +entry: + %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @a) + %arrayidx = getelementptr inbounds [87 x i32], ptr %tlv_addr, i64 0, i64 0 + ret ptr %arrayidx +} + define signext i32 @testUnaligned() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-LABEL: testUnaligned: ; SMALL-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry @@ -110,8 +304,8 @@ define signext i32 @testUnaligned() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C2(r2) # target-flags(ppc-tlsld) @ThreadLocalStruct -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwax r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: la r3, ThreadLocalStructAlign1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwa r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -122,12 +316,11 @@ define signext i32 @testUnaligned() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C2@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C2@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwax r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: la r3, ThreadLocalStructAlign1[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwa r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -140,8 +333,7 @@ define signext i32 @testUnaligned() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C2(r2) # target-flags(ppc-tlsld) @ThreadLocalStruct -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, ThreadLocalStructAlign1[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -151,26 +343,213 @@ define signext i32 @testUnaligned() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testUnaligned: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C2@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C2@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, ThreadLocalStructAlign1[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testUnaligned: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C2(r2) # target-flags(ppc-tlsld) @ThreadLocalStructAlign1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testUnaligned: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C2@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C2@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testUnaligned: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C2(r2) # target-flags(ppc-tlsld) @ThreadLocalStructAlign1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testUnaligned: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C2@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C2@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: - %tlv_addr = call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalStruct) - %x = getelementptr inbounds %struct.anon, ptr %tlv_addr, i32 0, i32 0 - %value = load i32, ptr %x, align 1 - ret i32 %value + %tlv_addr1 = call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @ThreadLocalStructAlign1) + %x = getelementptr inbounds %struct.anon, ptr %tlv_addr1, i32 0, i32 0 + %value1 = load i32, ptr %x, align 1 + ret i32 %value1 +} + +define signext i32 @testAligned() { +; SMALL-LOCAL-DYNAMIC-SMALLCM64-LABEL: testAligned: +; SMALL-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwa r3, ThreadLocalStructAlign4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-LARGECM64-LABEL: testAligned: +; SMALL-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwa r3, ThreadLocalStructAlign4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testAligned: +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, ThreadLocalStructAlign4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testAligned: +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, ThreadLocalStructAlign4[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testAligned: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C3(r2) # target-flags(ppc-tlsld) @ThreadLocalStructAlign4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testAligned: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C3@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C3@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testAligned: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C3(r2) # target-flags(ppc-tlsld) @ThreadLocalStructAlign4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testAligned: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C3@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C3@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +entry: + %tlv_addr1 = call align 1 ptr @llvm.threadlocal.address.p0(ptr align 4 @ThreadLocalStructAlign4) + %x = getelementptr inbounds %struct.anon, ptr %tlv_addr1, i32 0, i32 0 + %value1 = load i32, ptr %x, align 1 + ret i32 %value1 } define void @testChar(i8 noundef signext %x) { @@ -182,8 +561,7 @@ define void @testChar(i8 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C3(r2) # target-flags(ppc-tlsld) @tlv_char -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stbx r6, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stb r6, tlv_char[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -195,12 +573,10 @@ define void @testChar(i8 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mr r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C3@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C3@l(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stbx r6, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stb r6, tlv_char[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -217,8 +593,7 @@ define void @testChar(i8 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mr r4, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r5, L..C3(r2) # target-flags(ppc-tlsld) @tlv_char -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r4, r5 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r4, tlv_char[TL]@ld(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stb r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -232,21 +607,91 @@ define void @testChar(i8 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C3@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, 48(r1) # 8-byte Folded Reload ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mr r4, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, L..C3@l(r5) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r4, r5 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r4, tlv_char[TL]@ld(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stb r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testChar: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mr r6, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C4(r2) # target-flags(ppc-tlsld) @tlv_char +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stbx r6, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testChar: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mr r6, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C4@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C4@l(r7) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stbx r6, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testChar: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mr r4, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r5, L..C4(r2) # target-flags(ppc-tlsld) @tlv_char +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r4, r5 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stb r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testChar: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C4@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, 48(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mr r4, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, L..C4@l(r5) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r4, r5 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stb r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @tlv_char) store i8 %x, ptr %tlv_addr, align 1 @@ -262,8 +707,7 @@ define void @testShort(i16 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C4(r2) # target-flags(ppc-tlsld) @tlv_short -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: sthx r6, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: sth r6, tlv_short[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -275,12 +719,10 @@ define void @testShort(i16 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mr r6, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C4@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C4@l(r7) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: sthx r6, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: sth r6, tlv_short[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -297,8 +739,7 @@ define void @testShort(i16 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mr r4, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r5, L..C4(r2) # target-flags(ppc-tlsld) @tlv_short -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r4, r5 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r4, tlv_short[TL]@ld(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: sth r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -312,21 +753,91 @@ define void @testShort(i16 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C4@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, 48(r1) # 8-byte Folded Reload ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mr r4, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, L..C4@l(r5) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r4, r5 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r4, tlv_short[TL]@ld(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: sth r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testShort: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mr r6, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C5(r2) # target-flags(ppc-tlsld) @tlv_short +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: sthx r6, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testShort: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mr r6, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r7, L..C5@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C5@l(r7) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: sthx r6, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testShort: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mr r4, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r5, L..C5(r2) # target-flags(ppc-tlsld) @tlv_short +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r4, r5 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: sth r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testShort: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stw r3, 60(r1) # 4-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C5@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, 48(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mr r4, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 60(r1) # 4-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r5, L..C5@l(r5) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r4, r5 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: sth r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 2 ptr @llvm.threadlocal.address.p0(ptr align 2 @tlv_short) store i16 %x, ptr %tlv_addr, align 2 @@ -341,8 +852,7 @@ define signext i32 @testInt1() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C5(r2) # target-flags(ppc-tlsld) @tlv_int -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwax r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwa r3, tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -353,12 +863,10 @@ define signext i32 @testInt1() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C5@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C5@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwax r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwa r3, tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -371,8 +879,7 @@ define signext i32 @testInt1() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C5(r2) # target-flags(ppc-tlsld) @tlv_int -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -382,21 +889,81 @@ define signext i32 @testInt1() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testInt1: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C5@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C5@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testInt1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C6(r2) # target-flags(ppc-tlsld) @tlv_int +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testInt1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C6@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C6@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwax r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testInt1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C6(r2) # target-flags(ppc-tlsld) @tlv_int +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testInt1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C6@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C6@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @tlv_int) %value = load i32, ptr %tlv_addr, align 4 @@ -411,9 +978,8 @@ define signext i32 @testInt2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C6(r2) # target-flags(ppc-tlsld) @internal_tlv_int -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwzx r3, r3, r4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C7(r2) # @tlv_int_init +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C1(r2) # @tlv_int_init +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwz r3, internal_tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwz r4, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r4, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: extsw r3, r3 @@ -427,14 +993,12 @@ define signext i32 @testInt2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C6@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C6@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwzx r3, r3, r4 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r4, L..C7@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C7@l(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r4, L..C1@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C1@l(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwz r3, internal_tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lwz r4, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r4, r3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: extsw r3, r3 @@ -450,10 +1014,9 @@ define signext i32 @testInt2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C6(r2) # target-flags(ppc-tlsld) @internal_tlv_int -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, internal_tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r4, 0(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C7(r2) # @tlv_int_init +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C1(r2) # @tlv_int_init ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: extsw r3, r3 @@ -465,26 +1028,104 @@ define signext i32 @testInt2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testInt2: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C6@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C6@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, internal_tlv_int[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r4, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C7@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C7@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: extsw r3, r3 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testInt2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C7(r2) # target-flags(ppc-tlsld) @internal_tlv_int +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwzx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C8(r2) # @tlv_int_init +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwz r4, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: add r3, r4, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: extsw r3, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testInt2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C7@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C7@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwzx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r4, L..C8@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C8@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwz r4, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: add r3, r4, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: extsw r3, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testInt2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C7(r2) # target-flags(ppc-tlsld) @internal_tlv_int +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r4, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C8(r2) # @tlv_int_init +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: extsw r3, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testInt2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C7@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C7@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r4, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C8@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C8@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: extsw r3, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @internal_tlv_int) %tlv_val = load i32, ptr %tlv_addr, align 4 @@ -501,8 +1142,7 @@ define signext i64 @testLong1() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C8(r2) # target-flags(ppc-tlsld) @tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -513,12 +1153,10 @@ define signext i64 @testLong1() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C8@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C8@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -531,8 +1169,7 @@ define signext i64 @testLong1() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C8(r2) # target-flags(ppc-tlsld) @tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -542,21 +1179,81 @@ define signext i64 @testLong1() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong1: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C8@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C8@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testLong1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testLong1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C9@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C9@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testLong1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C9@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C9@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @tlv_long) %value = load i64, ptr %tlv_addr, align 4 @@ -571,10 +1268,9 @@ define void @testLong2(i64 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @internal_tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r5, r3, r4 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r5, r5, 9 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdx r5, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, internal_tlv_long[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r4, r4, 9 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r4, internal_tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -585,14 +1281,12 @@ define void @testLong2(i64 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C9@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C9@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r5, r3, r4 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r5, r5, 9 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdx r5, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, internal_tlv_long[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r4, r4, 9 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r4, internal_tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -605,8 +1299,7 @@ define void @testLong2(i64 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @internal_tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r4, internal_tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r3, 9 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r3, 0(r4) @@ -618,23 +1311,91 @@ define void @testLong2(i64 noundef signext %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong2: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C9@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C9@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r4, internal_tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r3, 9 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 0(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testLong2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @internal_tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r5, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r5, r5, 9 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdx r5, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testLong2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C10@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C10@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r5, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r5, r5, 9 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdx r5, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testLong2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @internal_tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r4, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r3, 9 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C10@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C10@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r4, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r3, 9 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @internal_tlv_long) %value = load i64, ptr %tlv_addr, align 8 @@ -651,8 +1412,7 @@ define i32 @testLong3() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C8(r2) # target-flags(ppc-tlsld) @tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -663,12 +1423,10 @@ define i32 @testLong3() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C8@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C8@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -681,8 +1439,7 @@ define i32 @testLong3() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C8(r2) # target-flags(ppc-tlsld) @tlv_long -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: clrldi r3, r3, 32 @@ -694,23 +1451,87 @@ define i32 @testLong3() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong3: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C8@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C8@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, tlv_long[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: clrldi r3, r3, 32 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testLong3: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ldx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testLong3: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C9@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C9@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ldx r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testLong3: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C9(r2) # target-flags(ppc-tlsld) @tlv_long +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testLong3: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C9@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C9@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $r3 killed $r3 killed $x3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @tlv_long) %value = load i64, ptr %tlv_addr, align 8 @@ -723,18 +1544,17 @@ define void @testFloat1(float noundef %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: vspltisw v2, 1 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: vspltisw v3, 8 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: xvcvsxwdp vs0, vs34 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @tlv_float -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfsx f1, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfs f1, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: fadds f0, f1, f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: xvcvsxwdp vs1, vs35 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: fadds f0, f0, f1 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfsx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfs f0, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -744,20 +1564,18 @@ define void @testFloat1(float noundef %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: vspltisw v2, 1 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C10@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: vspltisw v3, 8 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: xvcvsxwdp vs0, vs34 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C10@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfsx f1, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfs f1, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: fadds f0, f1, f0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: xvcvsxwdp vs1, vs35 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: fadds f0, f0, f1 -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfsx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfs f0, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -770,13 +1588,12 @@ define void @testFloat1(float noundef %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @tlv_float -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f0, 0(r3) -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C11(r2) # %const.1 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C2(r2) # %const.1 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f1, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fadds f0, f0, f1 -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C12(r2) # %const.0 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C3(r2) # %const.0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f1, 0(r4) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fadds f0, f0, f1 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfs f0, 0(r3) @@ -788,30 +1605,120 @@ define void @testFloat1(float noundef %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testFloat1: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C10@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C10@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f0, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C11@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C11@l(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C2@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C2@l(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f1, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fadds f0, f0, f1 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C12@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C12@l(r4) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C3@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C3@l(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f1, 0(r4) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fadds f0, f0, f1 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfs f0, 0(r3) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testFloat1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: vspltisw v2, 1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: vspltisw v3, 8 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: xvcvsxwdp vs0, vs34 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @tlv_float +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfsx f1, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: fadds f0, f1, f0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: xvcvsxwdp vs1, vs35 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfsx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testFloat1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: vspltisw v2, 1 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C11@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: vspltisw v3, 8 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: xvcvsxwdp vs0, vs34 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C11@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lfsx f1, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: fadds f0, f1, f0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: xvcvsxwdp vs1, vs35 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stfsx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testFloat1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @tlv_float +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C12(r2) # %const.1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f1, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C13(r2) # %const.0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f1, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testFloat1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C11@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C11@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C12@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C12@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f1, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r4, L..C13@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C13@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f1, 0(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fadds f0, f0, f1 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @tlv_float) %value = load float, ptr %tlv_addr, align 4 @@ -829,8 +1736,7 @@ define i32 @testFloat2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @tlv_float -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfsx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfs f0, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r1, 60 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: xscvdpsxws f0, f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfiwx f0, 0, r3 @@ -845,12 +1751,10 @@ define i32 @testFloat2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C10@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C10@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfsx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfs f0, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r1, 60 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: xscvdpsxws f0, f0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfiwx f0, 0, r3 @@ -867,8 +1771,7 @@ define i32 @testFloat2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C10(r2) # target-flags(ppc-tlsld) @tlv_float -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f0, 0(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fctiwz f0, f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfd f0, 56(r1) @@ -884,14 +1787,10 @@ define i32 @testFloat2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C10@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 48(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C10@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, tlv_float[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f0, 0(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fctiwz f0, f0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfd f0, 56(r1) @@ -901,6 +1800,86 @@ define i32 @testFloat2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testFloat2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @tlv_float +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfsx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r1, 60 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwz r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testFloat2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C11@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C11@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lfsx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r1, 60 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwz r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testFloat2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @tlv_float +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: fctiwz f0, f0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfd f0, 56(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwa r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testFloat2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C11@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 48(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 48(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C11@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfs f0, 0(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: fctiwz f0, f0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfd f0, 56(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwa r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @tlv_float) %value = load float, ptr %tlv_addr, align 4 @@ -916,8 +1895,7 @@ define void @testDouble1(double noundef %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @internal_tlv_double -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfdx f1, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfd f1, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 @@ -928,12 +1906,10 @@ define void @testDouble1(double noundef %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C11@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C11@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfdx f1, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfd f1, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 @@ -946,8 +1922,7 @@ define void @testDouble1(double noundef %x) { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C13(r2) # target-flags(ppc-tlsld) @internal_tlv_double -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stxsdx f1, 0, r3 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) @@ -957,21 +1932,81 @@ define void @testDouble1(double noundef %x) { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testDouble1: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C13@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -48(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C13@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stxsdx f1, 0, r3 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 48 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testDouble1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C12(r2) # target-flags(ppc-tlsld) @internal_tlv_double +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfdx f1, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testDouble1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C12@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C12@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stfdx f1, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testDouble1: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -48(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C14(r2) # target-flags(ppc-tlsld) @internal_tlv_double +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stxsdx f1, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 48 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testDouble1: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C14@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C14@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: add r3, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stxsdx f1, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @internal_tlv_double) store double %x, ptr %tlv_addr, align 8 @@ -986,8 +2021,7 @@ define i32 @testDouble2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C11(r2) # target-flags(ppc-tlsld) @internal_tlv_double -; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfdx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfd f0, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r1, 60 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: xscvdpsxws f0, f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfiwx f0, 0, r3 @@ -1002,12 +2036,10 @@ define i32 @testDouble2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -64(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C11@u(r2) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C11@l(r6) -; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfdx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: lfd f0, internal_tlv_double[TL]@ld(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r1, 60 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: xscvdpsxws f0, f0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-NEXT: stfiwx f0, 0, r3 @@ -1024,8 +2056,9 @@ define i32 @testDouble2() { ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C13(r2) # target-flags(ppc-tlsld) @internal_tlv_double -; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfdx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: la r3, internal_tlv_double[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfd f0, 0(r3) +; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: # kill: def $f1 killed $f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: xscvdpsxws f0, f0 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r1, 52 ; SMALL-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfiwx f0, 0, r3 @@ -1039,25 +2072,103 @@ define i32 @testDouble2() { ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testDouble2: ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -80(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 96(r1) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C13@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -64(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 80(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C0@u(r2) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C0@l(r3) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C13@l(r4) -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfdx f0, r3, r4 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: la r3, internal_tlv_double[TL]@ld(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfd f0, 0(r3) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: # kill: def $f1 killed $f0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: xscvdpsxws f0, f0 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r1, 68 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r1, 52 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfiwx f0, 0, r3 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 68(r1) +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 52(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: clrldi r3, r3, 32 -; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 80 +; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 64 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 ; SMALL-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-LABEL: testDouble2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r4, L..C12(r2) # target-flags(ppc-tlsld) @internal_tlv_double +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lfdx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r3, r1, 60 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: lwz r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-LABEL: testDouble2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r3, L..C0@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addis r6, L..C12@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r3, L..C0@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r4, L..C12@l(r6) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lfdx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r3, r1, 60 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: lwz r3, 60(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-LABEL: testDouble2: +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stdu r1, -64(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: std r0, 80(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r3, L..C0(r2) # target-flags(ppc-tlsldm) @"_$TLSML" +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r4, L..C14(r2) # target-flags(ppc-tlsld) @internal_tlv_double +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lfdx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r3, r1, 52 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: lwz r3, 52(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: addi r1, r1, 64 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-SMALLCM64-O0-NEXT: blr +; +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-LABEL: testDouble2: +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0: # %bb.0: # %entry +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mflr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stdu r1, -80(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r0, 96(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C14@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: std r3, 56(r1) # 8-byte Folded Spill +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addis r3, L..C1@u(r2) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r3, L..C1@l(r3) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: bla .__tls_get_mod[PR] +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, 56(r1) # 8-byte Folded Reload +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r4, L..C14@l(r4) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lfdx f0, r3, r4 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: xscvdpsxws f0, f0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r3, r1, 68 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: stfiwx f0, 0, r3 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: lwz r3, 68(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: clrldi r3, r3, 32 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: addi r1, r1, 80 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: ld r0, 16(r1) +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: mtlr r0 +; DEFAULT-LOCAL-DYNAMIC-LARGECM64-O0-NEXT: blr entry: %tlv_addr = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @internal_tlv_double) %value = load double, ptr %tlv_addr, align 8 diff --git a/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt-IRattribute.ll b/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt-IRattribute.ll index dc78ae8..fc49e94 100644 --- a/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt-IRattribute.ll +++ b/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt-IRattribute.ll @@ -8,23 +8,32 @@ ; RUN: -data-sections=false < %s 2>&1 | \ ; RUN: FileCheck %s --check-prefix=CHECK-UNSUPPORTED-NO-DATASEC -define dso_local signext i32 @testWithIRAttr() #0 { +define dso_local signext i32 @testWithIRAttrLocalExec() #0 { entry: ret i32 0 } -; Check that the aix-small-local-exec-tls attribute is not supported on Linux and AIX (32-bit). -; CHECK-NOT-SUPPORTED: The aix-small-local-exec-tls attribute is only supported on AIX in 64-bit mode. -; Check that the aix-small-local-exec-tls attribute is only supported when +define dso_local signext i32 @testWithIRAttrLocalDynamic() #1 { +entry: + ret i32 0 +} + +; Check that the aix-small-local-[exec|dynamic]-tls attribute is not supported on Linux and AIX (32-bit). +; CHECK-NOT-SUPPORTED: The aix-small-local-[exec|dynamic]-tls attribute is only supported on AIX in 64-bit mode. + +; Check that the aix-small-local-[exec|dynamic]-tls attribute is only supported when ; data sections are enabled. -; CHECK-UNSUPPORTED-NO-DATASEC: The aix-small-local-exec-tls attribute can only be specified with -data-sections. +; CHECK-UNSUPPORTED-NO-DATASEC: The aix-small-local-[exec|dynamic]-tls attribute can only be specified with -data-sections. ; Make sure that the test was actually compiled successfully after using the -; aix-small-local-exec-tls attribute. -; CHECK-LABEL: testWithIRAttr: +; aix-small-local-[exec|dynamic]-tls attribute. +; CHECK-LABEL: testWithIRAttrLocalExec: +; CHECK: li r3, 0 +; CHECK-NEXT: blr +; CHECK-LABEL: testWithIRAttrLocalDynamic: ; CHECK: li r3, 0 ; CHECK-NEXT: blr - attributes #0 = { "target-features"="+aix-small-local-exec-tls" } +attributes #1 = { "target-features"="+aix-small-local-dynamic-tls" } diff --git a/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll b/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll index 5104b7c..25bab5b 100644 --- a/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll +++ b/llvm/test/CodeGen/PowerPC/check-aix-small-local-exec-tls-opt.ll @@ -6,17 +6,25 @@ ; RUN: not llc -mtriple powerpc64le-unknown-linux-gnu -mattr=+aix-small-local-exec-tls \ ; RUN: -ppc-asm-full-reg-names < %s 2>&1 | \ ; RUN: FileCheck %s --check-prefix=CHECK-NOT-SUPPORTED +; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -mattr=+aix-small-local-dynamic-tls \ +; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s +; RUN: not llc -mtriple powerpc-ibm-aix-xcoff -mattr=+aix-small-local-dynamic-tls \ +; RUN: -ppc-asm-full-reg-names < %s 2>&1 | \ +; RUN: FileCheck %s --check-prefix=CHECK-NOT-SUPPORTED +; RUN: not llc -mtriple powerpc64le-unknown-linux-gnu -mattr=+aix-small-local-dynamic-tls \ +; RUN: -ppc-asm-full-reg-names < %s 2>&1 | \ +; RUN: FileCheck %s --check-prefix=CHECK-NOT-SUPPORTED define dso_local signext i32 @testNoIRAttr() { entry: ret i32 0 } -; Check that the aix-small-local-exec-tls attribute is not supported on Linux and AIX (32-bit). -; CHECK-NOT-SUPPORTED: The aix-small-local-exec-tls attribute is only supported on AIX in 64-bit mode. +; Check that the aix-small-local-[exec|dynamic]-tls attribute is not supported on Linux and AIX (32-bit). +; CHECK-NOT-SUPPORTED: The aix-small-local-[exec|dynamic]-tls attribute is only supported on AIX in 64-bit mode. ; Make sure that the test was actually compiled successfully after using the -; aix-small-local-exec-tls attribute. +; aix-small-local-[exec|dynamic]-tls attribute. ; CHECK-LABEL: testNoIRAttr: ; CHECK: li r3, 0 ; CHECK-NEXT: blr |