From ba718de434d3a86c521ca0f4db5ec98570ae35b0 Mon Sep 17 00:00:00 2001 From: Rick Gibbed Date: Fri, 24 May 2013 21:34:03 -0700 Subject: [PATCH] Further corrections on cr checks. --- src/xenia/cpu/x64/x64_emitter.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/x64/x64_emitter.cc b/src/xenia/cpu/x64/x64_emitter.cc index fd0832d94..d7ce2307b 100644 --- a/src/xenia/cpu/x64/x64_emitter.cc +++ b/src/xenia/cpu/x64/x64_emitter.cc @@ -1323,7 +1323,7 @@ GpVar X64Emitter::cr_value(uint32_t n) { GpVar value(c.newGpVar()); c.mov(value, qword_ptr(c.getGpArg(0), offsetof(xe_ppc_state_t, cr))); - if (n < 4) { + if (n < 7) { c.shr(value, imm(28 - n * 4)); } c.and_(value, imm(0xF)); @@ -1344,10 +1344,10 @@ void X64Emitter::update_cr_value(uint32_t n, GpVar& value) { GpVar cr_n(c.newGpVar()); c.mov(cr_n, value); c.and_(cr_n, imm(0xF)); - if (n) { - c.shl(cr_n, imm(n * 4)); + if (n < 7) { + c.shl(cr_n, imm(28 - n * 4)); } - c.and_(cr_tmp, imm(~(0xF << (n * 4)))); + c.and_(cr_tmp, imm(~(0xF << (28 - n * 4)))); c.or_(cr_tmp, cr_n); c.mov(qword_ptr(c.getGpArg(0), offsetof(xe_ppc_state_t, cr)), cr_tmp); }