From 3ebd53ba11b0e4dca6afda2f068614652686a7ff Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sun, 13 Dec 2015 18:28:38 -0600 Subject: [PATCH] Fix crandc/crnand/crnor/crorc not properly taking the complement of the CR fields. --- src/xenia/cpu/frontend/ppc_emit_control.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/frontend/ppc_emit_control.cc b/src/xenia/cpu/frontend/ppc_emit_control.cc index 302866a19..22958438e 100644 --- a/src/xenia/cpu/frontend/ppc_emit_control.cc +++ b/src/xenia/cpu/frontend/ppc_emit_control.cc @@ -353,7 +353,7 @@ XEEMITTER(crandc, 0x4C000102, XL)(PPCHIRBuilder& f, InstrData& i) { // CR[bt] <- CR[ba] & ¬CR[bb] bt=bo, ba=bi, bb=bb Value* ba = f.LoadCRField(i.XL.BI >> 2, i.XL.BI & 3); Value* bb = f.LoadCRField(i.XL.BB >> 2, i.XL.BB & 3); - Value* bt = f.And(ba, f.Not(bb)); + Value* bt = f.And(ba, f.And(f.Not(bb), f.LoadConstantInt8(0x01))); f.StoreCRField(i.XL.BO >> 2, i.XL.BO & 3, bt); return 0; } @@ -371,7 +371,7 @@ XEEMITTER(crnand, 0x4C0001C2, XL)(PPCHIRBuilder& f, InstrData& i) { // CR[bt] <- ¬(CR[ba] & CR[bb]) bt=bo, ba=bi, bb=bb Value* ba = f.LoadCRField(i.XL.BI >> 2, i.XL.BI & 3); Value* bb = f.LoadCRField(i.XL.BB >> 2, i.XL.BB & 3); - Value* bt = f.Not(f.And(ba, bb)); + Value* bt = f.And(f.Not(f.And(ba, bb)), f.LoadConstantInt8(0x01)); f.StoreCRField(i.XL.BO >> 2, i.XL.BO & 3, bt); return 0; } @@ -380,7 +380,7 @@ XEEMITTER(crnor, 0x4C000042, XL)(PPCHIRBuilder& f, InstrData& i) { // CR[bt] <- ¬(CR[ba] | CR[bb]) bt=bo, ba=bi, bb=bb Value* ba = f.LoadCRField(i.XL.BI >> 2, i.XL.BI & 3); Value* bb = f.LoadCRField(i.XL.BB >> 2, i.XL.BB & 3); - Value* bt = f.Not(f.Or(ba, bb)); + Value* bt = f.And(f.Not(f.Or(ba, bb)), f.LoadConstantInt8(0x01)); f.StoreCRField(i.XL.BO >> 2, i.XL.BO & 3, bt); return 0; } @@ -398,7 +398,7 @@ XEEMITTER(crorc, 0x4C000342, XL)(PPCHIRBuilder& f, InstrData& i) { // CR[bt] <- CR[ba] | ¬CR[bb] bt=bo, ba=bi, bb=bb Value* ba = f.LoadCRField(i.XL.BI >> 2, i.XL.BI & 3); Value* bb = f.LoadCRField(i.XL.BB >> 2, i.XL.BB & 3); - Value* bt = f.Or(ba, f.Not(bb)); + Value* bt = f.Or(ba, f.And(f.Not(bb), f.LoadConstantInt8(0x01))); f.StoreCRField(i.XL.BO >> 2, i.XL.BO & 3, bt); return 0; }