diff --git a/src/alloy/frontend/ppc/ppc_emit_memory.cc b/src/alloy/frontend/ppc/ppc_emit_memory.cc index 9ac067641..f0f63ac52 100644 --- a/src/alloy/frontend/ppc/ppc_emit_memory.cc +++ b/src/alloy/frontend/ppc/ppc_emit_memory.cc @@ -712,8 +712,7 @@ XEEMITTER(stdcx, 0x7C0001AD, X)(PPCHIRBuilder& f, InstrData& i) { // CR0[LT GT EQ SO] = 0b00 || n || XER[SO] Value* ea = CalculateEA_0(f, i.X.RA, i.X.RB); Value* rt = f.ByteSwap(f.LoadGPR(i.X.RT)); - Value* stored = f.StoreRelease(ea, rt); - f.StoreContext(offsetof(PPCContext, cr0.cr0_eq), stored); + f.StoreRelease(ea, rt); // also updates cr0 return 0; } @@ -729,8 +728,7 @@ XEEMITTER(stwcx, 0x7C00012D, X)(PPCHIRBuilder& f, InstrData& i) { // CR0[LT GT EQ SO] = 0b00 || n || XER[SO] Value* ea = CalculateEA_0(f, i.X.RA, i.X.RB); Value* rt = f.ByteSwap(f.Truncate(f.LoadGPR(i.X.RT), INT32_TYPE)); - Value* stored = f.StoreRelease(ea, rt); - f.StoreContext(offsetof(PPCContext, cr0.cr0_eq), stored); + f.StoreRelease(ea, rt); // also updates cr0 return 0; } diff --git a/src/alloy/frontend/ppc/ppc_hir_builder.cc b/src/alloy/frontend/ppc/ppc_hir_builder.cc index 64bf1dae4..3d5cf5f41 100644 --- a/src/alloy/frontend/ppc/ppc_hir_builder.cc +++ b/src/alloy/frontend/ppc/ppc_hir_builder.cc @@ -341,6 +341,7 @@ Value* PPCHIRBuilder::StoreRelease(Value* address, Value* value, LoadContext(offsetof(PPCContext, reserve_address), INT64_TYPE), LoadZero(INT32_TYPE)); Value* eq = CompareEQ(Truncate(address, INT32_TYPE), old_address); + StoreContext(offsetof(PPCContext, cr0.cr0_eq), eq); auto skip_label = NewLabel(); BranchFalse(eq, skip_label, BRANCH_UNLIKELY); Store(address, value, store_flags);