Build and insert `OldValRes<def>, SuccessRes<def> = G_ATOMIC_CMPXCHG_WITH_SUCCESS Addr, CmpVal, NewVal, MMO`.
Declared in <llvm/CodeGen/GlobalISel/MachineIRBuilder.h>
MachineInstrBuilder
buildAtomicCmpXchgWithSuccess(
DstOp const& OldValRes,
DstOp const& SuccessRes,
SrcOp const& Addr,
SrcOp const& CmpVal,
SrcOp const& NewVal,
MachineMemOperand& MMO);
Atomically replace the value at Addr with NewVal if it is currently CmpVal otherwise leaves it unchanged. Puts the original value from Addr in Res, along with an s1 indicating whether it was replaced.
a MachineInstrBuilder for the newly created instruction.
| Name | Description |
|---|---|
| OldValRes | Destination receiving the previous memory value. |
| SuccessRes | Destination receiving the success flag. |
| Addr | Address operand. |
| CmpVal | Expected current value for the compare-exchange. |
| NewVal | Replacement value written on success. |
| MMO | Memory operand describing the access. |
OldValRes must be a generic virtual register of scalar type.SuccessRes must be a generic virtual register of scalar type. It will be assigned 0 on failure and 1 on success.Addr must be a generic virtual register with pointer type.OldValRes, CmpVal, and NewVal must be generic virtual registers of the same type.