Skip to content

Commit

Permalink
IR: do not clobber flags in caspair
Browse files Browse the repository at this point in the history
slightly worse in the emulated case, I don't really care

Signed-off-by: Alyssa Rosenzweig <[email protected]>
  • Loading branch information
alyssarosenzweig committed Mar 29, 2024
1 parent aa26b62 commit 4523b03
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions FEXCore/Source/Interface/Core/JIT/Arm64/AtomicOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DEF_OP(CASPair) {
auto MemSrc = GetReg(Op->Addr.ID());

const auto EmitSize = IROp->ElementSize == 8 ? ARMEmitter::Size::i64Bit : ARMEmitter::Size::i32Bit;
if (CTX->HostFeatures.SupportsAtomics) {
if (CTX->HostFeatures.SupportsAtomics&&0) {
mov(EmitSize, TMP3, Expected.first);
mov(EmitSize, TMP4, Expected.second);

Expand All @@ -37,9 +37,10 @@ DEF_OP(CASPair) {
Bind(&LoopTop);

ldaxp(EmitSize, TMP2, TMP3, MemSrc);
cmp(EmitSize, TMP2, Expected.first);
ccmp(EmitSize, TMP3, Expected.second, ARMEmitter::StatusFlags::None, ARMEmitter::Condition::CC_EQ);
b(ARMEmitter::Condition::CC_NE, &LoopNotExpected);
eor(EmitSize, TMP1, TMP2, Expected.first);
eor(EmitSize, TMP4, TMP3, Expected.second);
orr(EmitSize, TMP1, TMP1, TMP4);
cbnz(EmitSize, TMP1, &LoopNotExpected);
stlxp(EmitSize, TMP2, Desired.first, Desired.second, MemSrc);
cbnz(EmitSize, TMP2, &LoopTop);
mov(EmitSize, Dst.first, Expected.first);
Expand Down

0 comments on commit 4523b03

Please sign in to comment.