Clarify the carry testing magic.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 8 May 2010 21:04:43 +0000 (21:04 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sat, 8 May 2010 21:04:43 +0000 (21:04 +0000)
[r27516]

ir/be/ia32/ia32_nodes_attr.h
ir/be/ia32/ia32_optimize.c

index fc53e6d..9b40123 100644 (file)
 #include "irnode_t.h"
 
 enum {
-       ia32_pn_Cmp_unsigned = 0x1000,
-       ia32_pn_Cmp_float    = 0x2000,
-       ia32_pn_Cmp_parity   = 0x4000
+       ia32_pn_Cmp_unsigned  = 0x1000,
+       ia32_pn_Cmp_float     = 0x2000,
+       ia32_pn_Cmp_parity    = 0x4000,
+       /* The unsigned Lt/Ge comparisons test the carry bit. */
+       ia32_pn_Cmp_carry     = pn_Cmp_Lt | ia32_pn_Cmp_unsigned
+       ia32_pn_Cmp_not_carry = pn_Cmp_Ge | ia32_pn_Cmp_unsigned,
 };
 
 typedef enum {
index 0334f34..801f8aa 100644 (file)
@@ -265,8 +265,8 @@ static void peephole_ia32_Test(ir_node *node)
                                        int      pnc  = get_ia32_condcode(user);
 
                                        switch (pnc) {
-                                               case pn_Cmp_Eq: pnc = pn_Cmp_Ge | ia32_pn_Cmp_unsigned; break;
-                                               case pn_Cmp_Lg: pnc = pn_Cmp_Lt | ia32_pn_Cmp_unsigned; break;
+                                               case pn_Cmp_Eq: pnc = ia32_pn_Cmp_no_carry; break;
+                                               case pn_Cmp_Lg: pnc = ia32_pn_Cmp_carry;    break;
                                                default: panic("unexpected pn");
                                        }
                                        set_ia32_condcode(user, pnc);