From 628390f3fa292d7677bb418af8d83bfeb57049f6 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 13 Mar 2014 23:02:46 -0700 Subject: [PATCH] armjit: Tiny optimization for cast to short. See these sometimes in code, skip the load of R0 when we can. --- Core/MIPS/ARM/ArmCompALU.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/ARM/ArmCompALU.cpp b/Core/MIPS/ARM/ArmCompALU.cpp index 41063e109b..de8f4d09d7 100644 --- a/Core/MIPS/ARM/ArmCompALU.cpp +++ b/Core/MIPS/ARM/ArmCompALU.cpp @@ -60,6 +60,11 @@ namespace MIPSComp Operand2 op2; if (TryMakeOperand2(uimm, op2)) { (this->*arith)(gpr.R(rt), gpr.R(rs), op2); +#ifdef HAVE_ARMV7 + } else if (eval == &EvalAnd && uimm == 0xFFFF) { + // This is common (e.g. a cast to a short.) + UBFX(gpr.R(rt), gpr.R(rs), 0, 16); +#endif } else { gpr.SetRegImm(R0, (u32)uimm); (this->*arith)(gpr.R(rt), gpr.R(rs), R0); @@ -115,7 +120,7 @@ namespace MIPSComp } break; - case 11: // R(rt) = R(rs) < uimm; break; //sltiu + case 11: // R(rt) = R(rs) < suimm; break; //sltiu { if (gpr.IsImm(rs)) { gpr.SetImm(rt, gpr.GetImm(rs) < suimm ? 1 : 0);