]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Specialise CondNS after SUBB on amd64.
authorJulian Seward <jseward@acm.org>
Mon, 31 Mar 2008 21:57:17 +0000 (21:57 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 31 Mar 2008 21:57:17 +0000 (21:57 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1817

VEX/priv/guest-amd64/ghelpers.c
VEX/priv/guest-x86/ghelpers.c

index b4bcf5f7cc8d3d67b2b3302f4506d30099ea018e..2f2bf7e04799bff154d05184d14c9784dc0f9457 100644 (file)
@@ -1043,6 +1043,18 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name,
                       binop(Iop_Shr64,cc_dep1,mkU8(7)),
                       mkU64(1));
       }
+      if (isU64(cc_op, AMD64G_CC_OP_SUBB) && isU64(cond, AMD64CondNS)
+                                          && isU64(cc_dep2, 0)) {
+         /* byte sub/cmp of zero, then NS --> test !(dst-0 <s 0)
+                                          --> test !(dst <s 0)
+                                          --> (ULong) !dst[7]
+         */
+         return binop(Iop_Xor64,
+                      binop(Iop_And64,
+                            binop(Iop_Shr64,cc_dep1,mkU8(7)),
+                            mkU64(1)),
+                      mkU64(1));
+      }
 
       /*---------------- LOGICQ ----------------*/
 
index fb54968011e35753d09db6848d3a53559eba2c0a..db4e3d2602b8825b316e5bc26ab5ede67b686837 100644 (file)
@@ -967,7 +967,6 @@ IRExpr* guest_x86_spechelper ( HChar* function_name,
                       binop(Iop_Shr32,cc_dep1,mkU8(7)),
                       mkU32(1));
       }
-
       if (isU32(cc_op, X86G_CC_OP_SUBB) && isU32(cond, X86CondNS)
                                         && isU32(cc_dep2, 0)) {
          /* byte sub/cmp of zero, then NS --> test !(dst-0 <s 0)