diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h index 1bb2a8e50c075..0d43265b41b59 100644 --- a/llvm/include/llvm/CodeGen/TargetLowering.h +++ b/llvm/include/llvm/CodeGen/TargetLowering.h @@ -1960,7 +1960,8 @@ class TargetLoweringBase { /// Perform a masked atomicrmw using a target-specific intrinsic. This /// represents the core LL/SC loop which will be lowered at a late stage by - /// the backend. + /// the backend. The target-specific intrinsic returns the loaded value and + /// is not responsible for masking and shifting the result. virtual Value *emitMaskedAtomicRMWIntrinsic(IRBuilderBase &Builder, AtomicRMWInst *AI, Value *AlignedAddr, Value *Incr, @@ -1979,7 +1980,8 @@ class TargetLoweringBase { /// Perform a masked cmpxchg using a target-specific intrinsic. This /// represents the core LL/SC loop which will be lowered at a late stage by - /// the backend. + /// the backend. The target-specific intrinsic returns the loaded value and + /// is not responsible for masking and shifting the result. virtual Value *emitMaskedAtomicCmpXchgIntrinsic( IRBuilderBase &Builder, AtomicCmpXchgInst *CI, Value *AlignedAddr, Value *CmpVal, Value *NewVal, Value *Mask, AtomicOrdering Ord) const { diff --git a/llvm/include/llvm/IR/IntrinsicsRISCV.td b/llvm/include/llvm/IR/IntrinsicsRISCV.td index 098ca1bc6cfbf..2a28d8142ae47 100644 --- a/llvm/include/llvm/IR/IntrinsicsRISCV.td +++ b/llvm/include/llvm/IR/IntrinsicsRISCV.td @@ -50,19 +50,26 @@ let TargetPrefix = "riscv" in { def _i64 : MaskedAtomicRMWFiveArg; } - // @llvm.riscv.masked.atomicrmw.*.{i32,i64}.

(...) + // These intrinsics are intended only for internal compiler use (i.e. as + // part of AtomicExpandpass via the emitMaskedAtomic*Intrinsic hooks). Their + // names and semantics could change in the future. + + // @llvm.riscv.masked.atomicrmw.*.{i32,i64}.

( + // ptr addr, ixlen oparg, ixlen mask, ixlenimm ordering) defm int_riscv_masked_atomicrmw_xchg : MaskedAtomicRMWFourArgIntrinsics; defm int_riscv_masked_atomicrmw_add : MaskedAtomicRMWFourArgIntrinsics; defm int_riscv_masked_atomicrmw_sub : MaskedAtomicRMWFourArgIntrinsics; defm int_riscv_masked_atomicrmw_nand : MaskedAtomicRMWFourArgIntrinsics; + defm int_riscv_masked_atomicrmw_umax : MaskedAtomicRMWFourArgIntrinsics; + defm int_riscv_masked_atomicrmw_umin : MaskedAtomicRMWFourArgIntrinsics; // Signed min and max need an extra operand to do sign extension with. + // @llvm.riscv.masked.atomicrmw.{max,min}.{i32,i64}.

( + // ptr addr, ixlen oparg, ixlen mask, ixlen shamt, ixlenimm ordering) defm int_riscv_masked_atomicrmw_max : MaskedAtomicRMWFiveArgIntrinsics; defm int_riscv_masked_atomicrmw_min : MaskedAtomicRMWFiveArgIntrinsics; - // Unsigned min and max don't need the extra operand. - defm int_riscv_masked_atomicrmw_umax : MaskedAtomicRMWFourArgIntrinsics; - defm int_riscv_masked_atomicrmw_umin : MaskedAtomicRMWFourArgIntrinsics; - // @llvm.riscv.masked.cmpxchg.{i32,i64}.

(...) + // @llvm.riscv.masked.cmpxchg.{i32,i64}.

( + // ptr addr, ixlen cmpval, ixlen newval, ixlen mask, ixlenimm ordering) defm int_riscv_masked_cmpxchg : MaskedAtomicRMWFiveArgIntrinsics; } // TargetPrefix = "riscv"