[AMDGPU] Refactor shouldExpandAtomicRMWInIR(). NFC.

This is logic simplification for better readability.

Differential Revision: https://reviews.llvm.org/D102371
This commit is contained in:
Stanislav Mekhanoshin 2021-05-12 14:18:16 -07:00
parent b7911e80d6
commit bd00106d1e
1 changed files with 7 additions and 6 deletions

View File

@ -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