]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Specialise CondNS after SUBB. The lack of this was causing Memcheck to
authorJulian Seward <jseward@acm.org>
Mon, 31 Mar 2008 01:51:57 +0000 (01:51 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 31 Mar 2008 01:51:57 +0000 (01:51 +0000)
report false positives in some tricky bitfield code in OOo 2.4 (writer)
when loading MS Word docs.

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

VEX/priv/guest-x86/ghelpers.c

index b5d0ad5b8f137421d0ce8ab7c195648f1848c8d6..fb54968011e35753d09db6848d3a53559eba2c0a 100644 (file)
@@ -968,6 +968,19 @@ IRExpr* guest_x86_spechelper ( HChar* function_name,
                       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) 
+                                          --> test !(dst <s 0)
+                                          --> (UInt) !dst[7] 
+         */
+         return binop(Iop_Xor32,
+                      binop(Iop_And32,
+                            binop(Iop_Shr32,cc_dep1,mkU8(7)),
+                            mkU32(1)),
+                mkU32(1));
+      }
+
       /*---------------- LOGICL ----------------*/
 
       if (isU32(cc_op, X86G_CC_OP_LOGICL) && isU32(cond, X86CondZ)) {