From 04742e00fc19b2af2243f6c1191f01bca5b53180 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 30 Nov 2013 15:53:21 +0100 Subject: [PATCH] Shave one instruction off slti and slt on ARM. --- Core/MIPS/ARM/ArmCompALU.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/ARM/ArmCompALU.cpp b/Core/MIPS/ARM/ArmCompALU.cpp index 41063e109b..c5ac2daa21 100644 --- a/Core/MIPS/ARM/ArmCompALU.cpp +++ b/Core/MIPS/ARM/ArmCompALU.cpp @@ -106,12 +106,18 @@ namespace MIPSComp break; } gpr.MapDirtyIn(rt, rs); +#if 0 CMPI2R(gpr.R(rs), simm, R0); SetCC(CC_LT); MOVI2R(gpr.R(rt), 1); SetCC(CC_GE); MOVI2R(gpr.R(rt), 0); SetCC(CC_AL); +#else + // Simply subtract, then use a logical shift to grab the sign bit. + ADDI2R(R0, gpr.R(rs), -simm, R1); + LSR(gpr.R(rt), R0, 31); +#endif } break; @@ -128,6 +134,9 @@ namespace MIPSComp SetCC(CC_HS); MOVI2R(gpr.R(rt), 0); SetCC(CC_AL); + + // For unsigned, to do the same trick as with signed we need to extract the carry and that + // is probably more expensive than this. } break; @@ -364,7 +373,10 @@ namespace MIPSComp CMN(gpr.R(rs), op2); } else { gpr.MapDirtyInIn(rd, rs, rt); - CMP(gpr.R(rs), gpr.R(rt)); + SUB(R0, gpr.R(rs), gpr.R(rt)); + LSR(gpr.R(rd), R0, 31); + return; + // CMP(gpr.R(rs), gpr.R(rt)); } SetCC(caseOne);