]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Moving Iop_F64toI32S to correct (binary ops) place in iselWordExpr_R_wrk.
authorPetar Jovanovic <mips32r2@gmail.com>
Wed, 20 Jun 2012 17:53:32 +0000 (17:53 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Wed, 20 Jun 2012 17:53:32 +0000 (17:53 +0000)
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

VEX/priv/host_mips_isel.c

index ba6e8df08ef28e685f61987ca1ed57a682c5c436..f61a663d4a39ddbb45259833966df65af4bb5f2c 100644 (file)
@@ -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: