Skip to content

Commit fe68fb6

Browse files
authored
[AArch64] Make the list of LSE supported operations explicit (llvm#171126)
Similar to llvm#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 llvm#170450
1 parent d478baa commit fe68fb6

File tree

2 files changed

+1609
-473
lines changed

2 files changed

+1609
-473
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29759,12 +29759,26 @@ AArch64TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
2975929759
AI->getOperation() == AtomicRMWInst::FMinimum))
2976029760
return AtomicExpansionKind::None;
2976129761

29762-
// Nand is not supported in LSE.
2976329762
// Leave 128 bits to LLSC or CmpXChg.
29764-
if (AI->getOperation() != AtomicRMWInst::Nand && Size < 128 &&
29765-
!AI->isFloatingPointOperation()) {
29766-
if (Subtarget->hasLSE())
29767-
return AtomicExpansionKind::None;
29763+
if (Size < 128 && !AI->isFloatingPointOperation()) {
29764+
if (Subtarget->hasLSE()) {
29765+
// Nand is not supported in LSE.
29766+
switch (AI->getOperation()) {
29767+
case AtomicRMWInst::Xchg:
29768+
case AtomicRMWInst::Add:
29769+
case AtomicRMWInst::Sub:
29770+
case AtomicRMWInst::And:
29771+
case AtomicRMWInst::Or:
29772+
case AtomicRMWInst::Xor:
29773+
case AtomicRMWInst::Max:
29774+
case AtomicRMWInst::Min:
29775+
case AtomicRMWInst::UMax:
29776+
case AtomicRMWInst::UMin:
29777+
return AtomicExpansionKind::None;
29778+
default:
29779+
break;
29780+
}
29781+
}
2976829782
if (Subtarget->outlineAtomics()) {
2976929783
// [U]Min/[U]Max RWM atomics are used in __sync_fetch_ libcalls so far.
2977029784
// Don't outline them unless

0 commit comments

Comments
 (0)