[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 19:12:46 PDT 2024
================
@@ -5743,6 +5747,14 @@ LoongArchTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const {
}
unsigned Size = AI->getType()->getPrimitiveSizeInBits();
+ if (Subtarget.hasLAMCAS()) {
+ if (AI->getOperation() == AtomicRMWInst::Nand ||
+ (Size < 32 /*&& (AI->getOperation() != AtomicRMWInst::Or &&
----------------
tangaac wrote:
atomicrmw nand & i8 / i16 atomicrmw add / sub / [u]min / [u]max should be converted to amcas.
i8 / i16 atomicrmw and / or / xor shouldn't be converted to amcas because they can use am(and / or / xor).w to expand.
But after feature LAMCAS enabled, all i8,i16 atomicrmw operations will be converted to amcas,
how to fix it?
https://github.com/llvm/llvm-project/pull/114189
More information about the cfe-commits
mailing list