]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: fix set_MIPS_rounding_mode()
authorPetar Jovanovic <mips32r2@gmail.com>
Mon, 22 May 2017 15:14:06 +0000 (15:14 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Mon, 22 May 2017 15:14:06 +0000 (15:14 +0000)
Do not override input argument. This fixes issues seen with CSE.

Patch by Tamara Vlahovic.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3381

VEX/priv/host_mips_isel.c

index c06953a7656945a364502621584a1854b21fc280..580865b45541694dee1a54ee1b56813e9d235e0c 100644 (file)
@@ -284,7 +284,7 @@ static void set_MIPS_rounding_mode(ISelEnv * env, IRExpr * mode)
    addInstr(env, MIPSInstr_Shft(Mshft_SLL, True, tmp, irrm,
                                 MIPSRH_Imm(False, 1)));
    addInstr(env, MIPSInstr_Alu(Malu_XOR, tmp, irrm, MIPSRH_Reg(tmp)));
-   addInstr(env, MIPSInstr_Alu(Malu_AND, irrm, tmp, MIPSRH_Imm(False, 3)));
+   addInstr(env, MIPSInstr_Alu(Malu_AND, tmp, tmp, MIPSRH_Imm(False, 3)));
    /* save old value of FCSR */
    addInstr(env, MIPSInstr_MfFCSR(fcsr_old));
    sub_from_sp(env, 8); /*  Move SP down 8 bytes */
@@ -294,7 +294,7 @@ static void set_MIPS_rounding_mode(ISelEnv * env, IRExpr * mode)
    addInstr(env, MIPSInstr_Store(4, am_addr, fcsr_old, mode64));
 
    /* set new value of FCSR */
-   addInstr(env, MIPSInstr_MtFCSR(irrm));
+   addInstr(env, MIPSInstr_MtFCSR(tmp));
 }
 
 static void set_MIPS_rounding_default(ISelEnv * env)