Skip to content

Commit 50f16ff

Browse files
authored
[AArch64] Make the list of outline atomic supported operations explicit (#167760)
As new operations are added (for example uinc_wrap, udec_wrap, usub_cond, usub_sat), they will not automatically be supported by outline atomics and so should be expanded by the pre-isel pass. Make the list of supported outline atomics explicit to make sure we only mark the expected intrinsics as outline atomics. Fixes #167728
1 parent 23f6a8a commit 50f16ff

File tree

2 files changed

+345
-26
lines changed

2 files changed

+345
-26
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29340,11 +29340,16 @@ AArch64TargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
2934029340
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0493r1.pdf
2934129341
// (2) low level libgcc and compiler-rt support implemented by:
2934229342
// min/max outline atomics helpers
29343-
if (AI->getOperation() != AtomicRMWInst::Min &&
29344-
AI->getOperation() != AtomicRMWInst::Max &&
29345-
AI->getOperation() != AtomicRMWInst::UMin &&
29346-
AI->getOperation() != AtomicRMWInst::UMax) {
29343+
switch (AI->getOperation()) {
29344+
case AtomicRMWInst::Xchg:
29345+
case AtomicRMWInst::Add:
29346+
case AtomicRMWInst::Sub:
29347+
case AtomicRMWInst::And:
29348+
case AtomicRMWInst::Or:
29349+
case AtomicRMWInst::Xor:
2934729350
return AtomicExpansionKind::None;
29351+
default:
29352+
break;
2934829353
}
2934929354
}
2935029355
}

0 commit comments

Comments
 (0)