]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fold in a fix for ppc32 rounding mode setting, from the trunk.
authorJulian Seward <jseward@acm.org>
Thu, 23 Feb 2006 23:47:56 +0000 (23:47 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 23 Feb 2006 23:47:56 +0000 (23:47 +0000)
git-svn-id: svn://svn.valgrind.org/vex/branches/VEX_3_1_BRANCH@1577

VEX/priv/guest-ppc32/toIR.c

index 622a6dd950a75f336e06baa7efd1cb26bf545246..a251cf37e4bc1c0a8ee343ebcdf51d55916b5a0c 100644 (file)
@@ -1595,8 +1595,22 @@ static void putSPR_masked ( PPC32SPR reg, IRExpr* src, UInt mask )
 
       /* Allow writes to Rounding Mode */
       if (mask & 0x3) {
-         stmt( IRStmt_Put( OFFB_FPROUND,
-                           binop(Iop_And32, src, mkU32(0x3)) ));
+         /* construct new fpround from new and old values as per mask:
+            new fpround = (src & (3 & mask)) | (fpround & (3 & ~mask)) */
+         stmt(
+            IRStmt_Put(
+               OFFB_FPROUND,
+               binop(
+                  Iop_Or32,
+                  binop(Iop_And32, src, mkU32(3 & mask)),
+                  binop(
+                     Iop_And32,
+                     IRExpr_Get(OFFB_FPROUND,Ity_I32),
+                     mkU32(3 & ~mask)
+                  )
+               )
+            )
+         );
       }
 
       /* Give EmWarn for attempted writes to: