]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a bit of structure in x86guest_findhelper.
authorJulian Seward <jseward@acm.org>
Thu, 26 Aug 2004 01:25:07 +0000 (01:25 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 26 Aug 2004 01:25:07 +0000 (01:25 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@214

VEX/priv/guest-x86/ghelpers.c

index 1db7e98fb1bf191a19641101b11e5d4f81077336..968867d2b703cda2275f7a1d5656c9da9d27b49d 100644 (file)
@@ -506,7 +506,7 @@ static UInt calculate_eflags_c ( UInt cc_op, UInt cc_src, UInt cc_dst )
    tab[cc_op][cond]++;
    n_calc_cond++;
 
-   if (0 == ((n_calc_all+n_calc_c) & 0x0FFF)) showCounts();
+   if (0 == ((n_calc_all+n_calc_c) & 0x3FFF)) showCounts();
 #  endif
 
    switch (cond) {
@@ -651,13 +651,44 @@ IRExpr* x86guest_spechelper ( Char* function_name,
       cc_src = args[2];
       cc_dst = args[3];
 
-      if (isU32(cc_op, CC_OP_LOGICB) && isU32(cond, CondZ)) {
-         /* byte and/or/xor, then Z --> test dst==0 */
+      /*---------------- SUBL ----------------*/
+
+      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondZ)) {
+         /* long sub/cmp, then Z --> test dst==src */
          return unop(Iop_1Uto32,
-                     binop(Iop_CmpEQ32, binop(Iop_And32,cc_dst,mkU32(255)), 
-                                        mkU32(0)));
+                     binop(Iop_CmpEQ32, cc_dst, cc_src));
+      }
+
+      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondL)) {
+         /* long sub/cmp, then L (signed less than) 
+            --> test dst <s src */
+         return unop(Iop_1Uto32,
+                     binop(Iop_CmpLT32S, cc_dst, cc_src));
+      }
+
+      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondLE)) {
+         /* long sub/cmp, then LE (signed less than or equal)
+            --> test dst <=s src */
+         return unop(Iop_1Uto32,
+                     binop(Iop_CmpLE32S, cc_dst, cc_src));
+      }
+
+      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondBE)) {
+         /* long sub/cmp, then BE (unsigned less than or equal)
+            --> test dst <=u src */
+         return unop(Iop_1Uto32,
+                     binop(Iop_CmpLE32U, cc_dst, cc_src));
+      }
+
+      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondB)) {
+         /* long sub/cmp, then B (unsigned less than)
+            --> test dst <u src */
+         return unop(Iop_1Uto32,
+                     binop(Iop_CmpLT32U, cc_dst, cc_src));
       }
 
+      /*---------------- SUBW ----------------*/
+
       if (isU32(cc_op, CC_OP_SUBW) && isU32(cond, CondZ)) {
          /* byte sub/cmp, then Z --> test dst==src */
          return unop(Iop_1Uto32,
@@ -666,6 +697,8 @@ IRExpr* x86guest_spechelper ( Char* function_name,
                            unop(Iop_32to16,cc_src)));
       }
 
+      /*---------------- SUBB ----------------*/
+
       if (isU32(cc_op, CC_OP_SUBB) && isU32(cond, CondZ)) {
          /* byte sub/cmp, then Z --> test dst==src */
          return unop(Iop_1Uto32,
@@ -691,6 +724,8 @@ IRExpr* x86guest_spechelper ( Char* function_name,
                           binop(Iop_And32,cc_dst,mkU32(0xFFFF))));
       }
 
+      /*---------------- LOGICL ----------------*/
+
       if (isU32(cc_op, CC_OP_LOGICL) && isU32(cond, CondZ)) {
          /* long and/or/xor, then Z --> test dst==0 */
          return unop(Iop_1Uto32,binop(Iop_CmpEQ32, cc_dst, mkU32(0)));
@@ -711,39 +746,16 @@ IRExpr* x86guest_spechelper ( Char* function_name,
          return unop(Iop_1Uto32,binop(Iop_CmpLE32S, cc_dst, mkU32(0)));
       }
 
-      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondZ)) {
-         /* long sub/cmp, then Z --> test dst==src */
-         return unop(Iop_1Uto32,
-                     binop(Iop_CmpEQ32, cc_dst, cc_src));
-      }
-
-      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondL)) {
-         /* long sub/cmp, then L (signed less than) 
-            --> test dst <s src */
-         return unop(Iop_1Uto32,
-                     binop(Iop_CmpLT32S, cc_dst, cc_src));
-      }
-
-      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondLE)) {
-         /* long sub/cmp, then LE (signed less than or equal)
-            --> test dst <=s src */
-         return unop(Iop_1Uto32,
-                     binop(Iop_CmpLE32S, cc_dst, cc_src));
-      }
+      /*---------------- LOGICB ----------------*/
 
-      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondBE)) {
-         /* long sub/cmp, then BE (unsigned less than or equal)
-            --> test dst <=u src */
+      if (isU32(cc_op, CC_OP_LOGICB) && isU32(cond, CondZ)) {
+         /* byte and/or/xor, then Z --> test dst==0 */
          return unop(Iop_1Uto32,
-                     binop(Iop_CmpLE32U, cc_dst, cc_src));
+                     binop(Iop_CmpEQ32, binop(Iop_And32,cc_dst,mkU32(255)), 
+                                        mkU32(0)));
       }
 
-      if (isU32(cc_op, CC_OP_SUBL) && isU32(cond, CondB)) {
-         /* long sub/cmp, then B (unsigned less than)
-            --> test dst <u src */
-         return unop(Iop_1Uto32,
-                     binop(Iop_CmpLT32U, cc_dst, cc_src));
-      }
+      /*---------------- DECL ----------------*/
 
       if (isU32(cc_op, CC_OP_DECL) && isU32(cond, CondZ)) {
          /* dec L, then Z --> test dst == 0 */