(convert_to_integer): When optimizing LSHIFT_EXPR and
authorRichard Stallman <rms@gnu.org>
Wed, 9 Sep 1992 06:56:35 +0000 (06:56 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 9 Sep 1992 06:56:35 +0000 (06:56 +0000)
RSHIFT_EXPR, do compares at tree level.

From-SVN: r2086

gcc/c-convert.c

index afc3ad1dfc996a861cc694db8aa321b4bd035093..b160fd1b1acbf6e020e47dc67d790c394a01361d 100644 (file)
@@ -177,20 +177,20 @@ convert_to_integer (type, expr)
        {
        case RSHIFT_EXPR:
          /* We can pass truncation down through right shifting
-            when the shift count is a negative constant.  */
-         if (TREE_CODE (TREE_OPERAND (expr, 1)) != INTEGER_CST
-             || TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)) > 0)
-           break;
-         goto trunc1;
+            when the shift count is a nonpositive constant.  */
+         if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
+             && tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_one_node))
+           goto trunc1;
+         break;
 
        case LSHIFT_EXPR:
          /* We can pass truncation down through left shifting
-            when the shift count is a positive constant.  */
-         if (TREE_CODE (TREE_OPERAND (expr, 1)) != INTEGER_CST
-             || TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)) < 0)
-           break;
-         /* In this case, shifting is like multiplication.  */
-         goto trunc1;
+            when the shift count is a nonnegative constant.  */
+         if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
+             && ! tree_int_cst_lt (TREE_OPERAND (expr, 1), integer_zero_node))
+           /* In this case, shifting is like multiplication.  */
+           goto trunc1;
+         break;
 
        case MAX_EXPR:
        case MIN_EXPR: