]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a spec rule for V after SUB.
authorJulian Seward <jseward@acm.org>
Mon, 2 May 2011 18:57:56 +0000 (18:57 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 2 May 2011 18:57:56 +0000 (18:57 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@2140

VEX/priv/guest_arm_helpers.c

index 061b22bf97018419bf15ccc4dfef770a3cb189df..9c876573828485ff24ad8c05e2a83c40a57e1c18 100644 (file)
@@ -717,6 +717,25 @@ IRExpr* guest_arm_spechelper ( HChar*   function_name,
          return cc_ndep;
       }
 
+      if (isU32(cc_op, ARMG_CC_OP_SUB)) {
+         /* Thunk args are (argL, argR, unused) */
+         /* V after SUB 
+            --> let res = argL - argR
+                in ((argL ^ argR) & (argL ^ res)) >> 31
+            --> ((argL ^ argR) & (argL ^ (argL - argR))) >> 31
+         */
+         IRExpr* argL = cc_dep1;
+         IRExpr* argR = cc_dep2;
+         return
+            binop(Iop_Shr32,
+                  binop(Iop_And32,
+                        binop(Iop_Xor32, argL, argR),
+                        binop(Iop_Xor32, argL, binop(Iop_Sub32, argL, argR))
+                  ),
+                  mkU8(31)
+            );
+      }
+
       if (isU32(cc_op, ARMG_CC_OP_SBB)) {
          /* This happens occasionally in softfloat code, eg __divdf3+140 */
          /* thunk is: (dep1=argL, dep2=argR, ndep=oldC) */