From bd00106d1e77e4de769ce0d143c97a076f25c92b Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Wed, 12 May 2021 14:18:16 -0700 Subject: [PATCH] [AMDGPU] Refactor shouldExpandAtomicRMWInIR(). NFC. This is logic simplification for better readability. Differential Revision: https://reviews.llvm.org/D102371 --- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 47247bca4c34..35a48918880e 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -12112,7 +12112,6 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const { if (!Ty->isFloatTy() && (!Subtarget->hasGFX90AInsts() || !Ty->isDoubleTy())) return AtomicExpansionKind::CmpXChg; - // TODO: Do have these for flat. Older targets also had them for buffers. unsigned AS = RMW->getPointerAddressSpace(); if ((AS == AMDGPUAS::GLOBAL_ADDRESS || AS == AMDGPUAS::FLAT_ADDRESS) && @@ -12128,20 +12127,22 @@ SITargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *RMW) const { return AtomicExpansionKind::CmpXChg; if (Subtarget->hasGFX90AInsts()) { + if (Ty->isFloatTy() && AS == AMDGPUAS::FLAT_ADDRESS) + return AtomicExpansionKind::CmpXChg; + auto SSID = RMW->getSyncScopeID(); if (SSID == SyncScope::System || SSID == RMW->getContext().getOrInsertSyncScopeID("one-as")) return AtomicExpansionKind::CmpXChg; - return (Ty->isFloatTy() && AS == AMDGPUAS::FLAT_ADDRESS) ? - AtomicExpansionKind::CmpXChg : AtomicExpansionKind::None; + return AtomicExpansionKind::None; } - if (!Subtarget->hasGFX90AInsts() && AS != AMDGPUAS::GLOBAL_ADDRESS) + if (AS == AMDGPUAS::FLAT_ADDRESS) return AtomicExpansionKind::CmpXChg; - return RMW->use_empty() ? AtomicExpansionKind::None : - AtomicExpansionKind::CmpXChg; + return RMW->use_empty() ? AtomicExpansionKind::None + : AtomicExpansionKind::CmpXChg; } // DS FP atomics do repect the denormal mode, but the rounding mode is fixed