combine.c (simplify_comparison): If simplifying a logical shift right and compare...
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 7 Mar 2002 10:39:50 +0000 (10:39 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 7 Mar 2002 10:39:50 +0000 (10:39 +0000)
* combine.c (simplify_comparison): If simplifying a logical shift
right and compare with constant, force the comparison to unsigned.

From-SVN: r50400

gcc/ChangeLog
gcc/combine.c

index 555d2ff1d051a1f935e313e24dc31d3ca01b8ad0..6def6705e0bc1f48fea09435230669c080e31ffd 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-07  Richard Earnshaw  <rearnsha@arm.com>
+
+       * combine.c (simplify_comparison): If simplifying a logical shift
+       right and compare with constant, force the comparison to unsigned.
+
 2002-03-07  Aldy Hernandez  <aldyh@redhat.com>
 
         * doc/invoke.texi: Add documentation for -mabi=no-altivec.
index 733ce27ee2f8180f10982d4ee8c1d3f37b33683b..a155555c5fcbb1b3fca23907e1f43e354e6ea47d 100644 (file)
@@ -10885,6 +10885,11 @@ simplify_comparison (code, pop0, pop1)
                  || (floor_log2 (const_op) + INTVAL (XEXP (op0, 1))
                      < mode_width)))
            {
+             /* If the shift was logical, then we must make the condition
+                unsigned.  */
+             if (GET_CODE (op0) == LSHIFTRT)
+               code = unsigned_condition (code);
+
              const_op <<= INTVAL (XEXP (op0, 1));
              op1 = GEN_INT (const_op);
              op0 = XEXP (op0, 0);