From 4c4cc4951077de900d2ea6b8fc39043a7f25de5f Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 1 May 2014 11:47:48 -0600 Subject: [PATCH] use Compiler::truncateThenExtend in more places --- src/codegen/compiler.cpp | 1 + src/compile.cpp | 21 ++++++--------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/codegen/compiler.cpp b/src/codegen/compiler.cpp index 11a7b27b72..cf1e2751a0 100644 --- a/src/codegen/compiler.cpp +++ b/src/codegen/compiler.cpp @@ -2652,6 +2652,7 @@ class MyCompiler: public Compiler { assert(&c, dstType.size() >= TargetBytesPerWord); assert(&c, srcType.flavor() == srcSelectType.flavor()); assert(&c, srcType.flavor() == dstType.flavor()); + assert(&c, srcType == srcSelectType); Value* dst = value(&c, static_cast(src)->type); appendMove(&c, diff --git a/src/compile.cpp b/src/compile.cpp index 3862635a11..0a3e078aae 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -4807,19 +4807,13 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, } break; case i2b: { - frame->pushInt(c->load(ir::SignExtend, - types.address, - types.i1, - frame->popInt(), - types.address)); + frame->pushInt(c->truncateThenExtend( + ir::SignExtend, types.address, types.i1, frame->popInt())); } break; case i2c: { - frame->pushInt(c->load(ir::ZeroExtend, - types.address, - types.i2, - frame->popInt(), - types.address)); + frame->pushInt(c->truncateThenExtend( + ir::ZeroExtend, types.address, types.i2, frame->popInt())); } break; case i2d: { @@ -4836,11 +4830,8 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp, break; case i2s: { - frame->pushInt(c->load(ir::SignExtend, - types.address, - types.i2, - frame->popInt(), - types.address)); + frame->pushInt(c->truncateThenExtend( + ir::SignExtend, types.address, types.i2, frame->popInt())); } break; case iadd: