[AArch64] Make the list of LSE supported operations explicit (#171126)

Similar to #167760 this makes the list of LSE atomics explicit in case
new operations are added in the future. UIncWrap, UDecWrap, USubCond and
USubSat are excluded.

Fixes #170450
This commit is contained in:
David Green
2025-12-09 14:22:42 +00:00
committed by GitHub
parent d478baa238
commit fe68fb62ea
2 changed files with 1609 additions and 473 deletions

View File

@@ -29759,12 +29759,26 @@ AArch64TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
AI->getOperation() == AtomicRMWInst::FMinimum))
return AtomicExpansionKind::None;
// Nand is not supported in LSE.
// Leave 128 bits to LLSC or CmpXChg.
if (AI->getOperation() != AtomicRMWInst::Nand && Size < 128 &&
!AI->isFloatingPointOperation()) {
if (Subtarget->hasLSE())
return AtomicExpansionKind::None;
if (Size < 128 && !AI->isFloatingPointOperation()) {
if (Subtarget->hasLSE()) {
// Nand is not supported in LSE.
switch (AI->getOperation()) {
case AtomicRMWInst::Xchg:
case AtomicRMWInst::Add:
case AtomicRMWInst::Sub:
case AtomicRMWInst::And:
case AtomicRMWInst::Or:
case AtomicRMWInst::Xor:
case AtomicRMWInst::Max:
case AtomicRMWInst::Min:
case AtomicRMWInst::UMax:
case AtomicRMWInst::UMin:
return AtomicExpansionKind::None;
default:
break;
}
}
if (Subtarget->outlineAtomics()) {
// [U]Min/[U]Max RWM atomics are used in __sync_fetch_ libcalls so far.
// Don't outline them unless

File diff suppressed because it is too large Load Diff