From 69704853a39d0d37853f43112d6f0e408eefadad Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Fri, 13 Dec 2013 20:11:04 -0800 Subject: [PATCH] Special casing sldi. --- src/alloy/frontend/ppc/ppc_emit_alu.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/alloy/frontend/ppc/ppc_emit_alu.cc b/src/alloy/frontend/ppc/ppc_emit_alu.cc index 9426ca957..9e8c8a272 100644 --- a/src/alloy/frontend/ppc/ppc_emit_alu.cc +++ b/src/alloy/frontend/ppc/ppc_emit_alu.cc @@ -882,11 +882,16 @@ XEEMITTER(rld, 0x78000000, MDS)(PPCFunctionBuilder& f, InstrData& i) { uint32_t mb = (i.MD.MB5 << 5) | i.MD.MB; uint64_t m = XEMASK(0, mb); Value* v = f.LoadGPR(i.MD.RT); - if (sh) { - v = f.RotateLeft(v, f.LoadConstant((int8_t)sh)); - } - if (m != 0xFFFFFFFFFFFFFFFF) { - v = f.And(v, f.LoadConstant(m)); + if (mb == 63 - sh) { + // Shift left. + v = f.Shl(v, f.LoadConstant((int8_t)sh)); + } else { + if (sh) { + v = f.RotateLeft(v, f.LoadConstant((int8_t)sh)); + } + if (m != 0xFFFFFFFFFFFFFFFF) { + v = f.And(v, f.LoadConstant(m)); + } } if (i.MD.Rc) { f.UpdateCR(0, v);