forked from OSchip/llvm-project
[AArch64] Use the CMP_SWAP_128 variants added in 843c6140
.
Accidentally forgot to flip the opcode... and I didn't notice because it was working fine for the GlobalISel.
This commit is contained in:
parent
05a6d74c48
commit
664a1fd9f0
|
@ -17055,13 +17055,32 @@ static void ReplaceCMP_SWAP_128Results(SDNode *N,
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned Opcode;
|
||||
switch (MemOp->getMergedOrdering()) {
|
||||
case AtomicOrdering::Monotonic:
|
||||
Opcode = AArch64::CMP_SWAP_128_MONOTONIC;
|
||||
break;
|
||||
case AtomicOrdering::Acquire:
|
||||
Opcode = AArch64::CMP_SWAP_128_ACQUIRE;
|
||||
break;
|
||||
case AtomicOrdering::Release:
|
||||
Opcode = AArch64::CMP_SWAP_128_RELEASE;
|
||||
break;
|
||||
case AtomicOrdering::AcquireRelease:
|
||||
case AtomicOrdering::SequentiallyConsistent:
|
||||
Opcode = AArch64::CMP_SWAP_128;
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Unexpected ordering!");
|
||||
}
|
||||
|
||||
auto Desired = splitInt128(N->getOperand(2), DAG);
|
||||
auto New = splitInt128(N->getOperand(3), DAG);
|
||||
SDValue Ops[] = {N->getOperand(1), Desired.first, Desired.second,
|
||||
New.first, New.second, N->getOperand(0)};
|
||||
SDNode *CmpSwap = DAG.getMachineNode(
|
||||
AArch64::CMP_SWAP_128, SDLoc(N),
|
||||
DAG.getVTList(MVT::i64, MVT::i64, MVT::i32, MVT::Other), Ops);
|
||||
Opcode, SDLoc(N), DAG.getVTList(MVT::i64, MVT::i64, MVT::i32, MVT::Other),
|
||||
Ops);
|
||||
DAG.setNodeMemRefs(cast<MachineSDNode>(CmpSwap), {MemOp});
|
||||
|
||||
Results.push_back(DAG.getNode(ISD::BUILD_PAIR, SDLoc(N), MVT::i128,
|
||||
|
|
|
@ -13,11 +13,11 @@ define i128 @val_compare_and_swap(i128* %p, i128 %oldval, i128 %newval) {
|
|||
; CHECK: cmp
|
||||
; CHECK: cinc [[MISMATCH:w[0-9]+]]
|
||||
; CHECK: cbz [[MISMATCH]], [[EQUAL:.LBB[0-9]+_[0-9]+]]
|
||||
; CHECK: stlxp [[SCRATCH_RES:w[0-9]+]], [[RESULTLO]], [[RESULTHI]], [x[[ADDR]]]
|
||||
; CHECK: stxp [[SCRATCH_RES:w[0-9]+]], [[RESULTLO]], [[RESULTHI]], [x[[ADDR]]]
|
||||
; CHECK: cbnz [[SCRATCH_RES]], [[LABEL]]
|
||||
; CHECK: b [[DONE:.LBB[0-9]+_[0-9]+]]
|
||||
; CHECK: [[EQUAL]]:
|
||||
; CHECK: stlxp [[SCRATCH_RES:w[0-9]+]], x4, x5, [x[[ADDR]]]
|
||||
; CHECK: stxp [[SCRATCH_RES:w[0-9]+]], x4, x5, [x[[ADDR]]]
|
||||
; CHECK: cbnz [[SCRATCH_RES]], [[LABEL]]
|
||||
; CHECK: [[DONE]]:
|
||||
%pair = cmpxchg i128* %p, i128 %oldval, i128 %newval acquire acquire
|
||||
|
|
Loading…
Reference in New Issue