OSDN Git Service

(simplify_comparison): Use mode_width as shift count
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Dec 1996 20:27:35 +0000 (20:27 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Dec 1996 20:27:35 +0000 (20:27 +0000)
only if it is less than or equal to HOST_BITS_PER_WIDE_INT.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13312 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/combine.c

index 3864110..f4e0b97 100644 (file)
@@ -9296,7 +9296,8 @@ simplify_comparison (code, pop0, pop1)
            }
 
          /* (unsigned) < 0x80000000 is equivalent to >= 0.  */
-         else if (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1))
+         else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
+                  && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
            {
              const_op = 0, op1 = const0_rtx;
              code = GE;
@@ -9311,7 +9312,8 @@ simplify_comparison (code, pop0, pop1)
            code = EQ;
 
          /* (unsigned) <= 0x7fffffff is equivalent to >= 0.  */
-         else if (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1)
+         else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
+                  && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
            {
              const_op = 0, op1 = const0_rtx;
              code = GE;
@@ -9329,7 +9331,8 @@ simplify_comparison (code, pop0, pop1)
            }
 
          /* (unsigned) >= 0x80000000 is equivalent to < 0.  */
-         else if (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1))
+         else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
+                  && (const_op == (HOST_WIDE_INT) 1 << (mode_width - 1)))
            {
              const_op = 0, op1 = const0_rtx;
              code = LT;
@@ -9344,7 +9347,8 @@ simplify_comparison (code, pop0, pop1)
            code = NE;
 
          /* (unsigned) > 0x7fffffff is equivalent to < 0.  */
-         else if (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1)
+         else if ((mode_width <= HOST_BITS_PER_WIDE_INT)
+                   && (const_op == ((HOST_WIDE_INT) 1 << (mode_width - 1)) - 1))
            {
              const_op = 0, op1 = const0_rtx;
              code = LT;