From: Petar Jovanovic Date: Wed, 20 Jun 2012 17:53:32 +0000 (+0000) Subject: Moving Iop_F64toI32S to correct (binary ops) place in iselWordExpr_R_wrk. X-Git-Tag: svn/VALGRIND_3_8_1^2~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=819b08801599ee6a31110b3802925aab4003687b;p=thirdparty%2Fvalgrind.git Moving Iop_F64toI32S to correct (binary ops) place in iselWordExpr_R_wrk. In a previous commit (r2393), a break has been misplaced and caused two issues, and that revelead that Iop_F64toI32S was in the wrong (unary op) case. This fixes none/tests/mips32/round and memcheck/tests/vcpu_fnfns for MIPS. git-svn-id: svn://svn.valgrind.org/vex/trunk@2396 --- diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index ba6e8df08e..f61a663d4a 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -842,7 +842,6 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) return dst; break; - } if (e->Iex.Binop.op == Iop_Max32U) { @@ -1047,8 +1046,32 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) return r_dst; } - } + + if (e->Iex.Binop.op == Iop_F64toI32S) { + HReg valD = iselDblExpr(env, e->Iex.Binop.arg2); + HReg valS = newVRegF(env); + HReg r_dst = newVRegI(env); + MIPSAMode *am_addr; + + set_MIPS_rounding_mode(env, e->Iex.Binop.arg1); + addInstr(env, MIPSInstr_FpConvert(Mfp_CVTWD, valS, valD)); + set_MIPS_rounding_default(env); + + sub_from_sp(env, 16); // Move SP down 16 bytes + am_addr = MIPSAMode_IR(0, StackPointer(mode64)); + + // store as F32 + addInstr(env, MIPSInstr_FpLdSt(False/*store */ , 4, valS, am_addr)); + // load as I32 + addInstr(env, MIPSInstr_Load(4, r_dst, am_addr, mode64)); + + add_to_sp(env, 16); // Reset SP + + return r_dst; + } + break; + } /* --------- UNARY OP --------- */ case Iex_Unop: { @@ -1158,29 +1181,6 @@ static HReg iselWordExpr_R_wrk(ISelEnv * env, IRExpr * e) add_to_sp(env, 16); // Reset SP return r_dst; } - - case Iop_F64toI32S: { - HReg valD = iselDblExpr(env, e->Iex.Binop.arg2); - HReg valS = newVRegF(env); - HReg r_dst = newVRegI(env); - MIPSAMode *am_addr; - - set_MIPS_rounding_mode(env, e->Iex.Binop.arg1); - addInstr(env, MIPSInstr_FpConvert(Mfp_CVTWD, valS, valD)); - set_MIPS_rounding_default(env); - - sub_from_sp(env, 16); // Move SP down 16 bytes - am_addr = MIPSAMode_IR(0, StackPointer(mode64)); - - // store as F32 - addInstr(env, MIPSInstr_FpLdSt(False/*store */ , 4, valS, am_addr)); - // load as I32 - addInstr(env, MIPSInstr_Load(4, r_dst, am_addr, mode64)); - - add_to_sp(env, 16); // Reset SP - - return r_dst; - } case Iop_32to8: case Iop_32to16: