From 590adfce53420c288c092b282ed4b833b3fb9233 Mon Sep 17 00:00:00 2001 From: magumagu9 Date: Tue, 23 Dec 2008 13:16:52 +0000 Subject: [PATCH] Generalize constant folding for rlwinm. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1640 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Src/PowerPC/Jit64/Jit_Integer.cpp | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index 81ae7beec7..885a2d44d6 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -671,19 +671,15 @@ INSTRUCTION_START; int a = inst.RA; int s = inst.RS; - if (gpr.R(a).IsImm() || gpr.R(s).IsImm()) + if (gpr.R(s).IsImm() && !inst.Rc) { - if (gpr.R(s).IsImm()) - { - if (gpr.R(s).offset == 0 && !inst.Rc) { - // This is pretty common for some reason - gpr.LoadToX64(a, false); - XOR(32, gpr.R(a), gpr.R(a)); - return; - } - // This might also be worth doing. - } - Default(inst); + unsigned mask = Helper_Mask(inst.MB, inst.ME); + unsigned result = gpr.R(s).offset; + if (inst.SH != 0) + result = (result << inst.SH) | + (result >> (32 - inst.SH)); + result &= mask; + gpr.SetImmediate32(a, result); return; }