[clang] [llvm] [RISCV][LLVM] Enable atomics for 'Zalrsc' (PR #163672)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 16 08:50:52 PDT 2025
================
@@ -24483,6 +24483,26 @@ ISD::NodeType RISCVTargetLowering::getExtendForAtomicCmpSwapArg() const {
return Subtarget.hasStdExtZacas() ? ISD::ANY_EXTEND : ISD::SIGN_EXTEND;
}
+ISD::NodeType RISCVTargetLowering::getExtendForAtomicRMWArg(unsigned Op) const {
+ // Zaamo will use amo<op>.w which does not require extension.
+ if (Subtarget.hasStdExtZaamo() || Subtarget.hasForcedAtomics())
+ return ISD::ANY_EXTEND;
+
+ // Zalasr pseudo expansions with comparison
+ assert(Subtarget.hasStdExtZalrsc());
+ switch (Op) {
+ case ISD::ATOMIC_LOAD_MIN:
+ case ISD::ATOMIC_LOAD_MAX:
+ return ISD::SIGN_EXTEND;
+ case ISD::ATOMIC_LOAD_UMIN:
+ case ISD::ATOMIC_LOAD_UMAX:
+ return ISD::ZERO_EXTEND;
----------------
topperc wrote:
It would be ok to sign extend umin/umax as long as we also sign extend the value read from memory in ExpandAtomicPseudos. Which we would if we used the LR result directly.
https://github.com/llvm/llvm-project/pull/163672
More information about the cfe-commits
mailing list