OSDN Git Service

2005-12-02 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Dec 2005 09:38:57 +0000 (09:38 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Dec 2005 09:38:57 +0000 (09:38 +0000)
* convert.c (convert_to_integer): Use fold_convert instead
of fold_build1 (NOP_EXPR, ...).  Use tree_int_cst_sgn < 0
instead of comparing against 0.  Use build_int_cst instead
of converting integer_zero_node.

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

gcc/ChangeLog
gcc/convert.c

index e8ff571..b521d3f 100644 (file)
@@ -1,5 +1,12 @@
 2005-12-02  Richard Guenther  <rguenther@suse.de>
 
 2005-12-02  Richard Guenther  <rguenther@suse.de>
 
+       * convert.c (convert_to_integer): Use fold_convert instead
+       of fold_build1 (NOP_EXPR, ...).  Use tree_int_cst_sgn < 0
+       instead of comparing against 0.  Use build_int_cst instead
+       of converting integer_zero_node.
+
+2005-12-02  Richard Guenther  <rguenther@suse.de>
+
        * tree-pretty-print.c (op_symbol): Handle LROTATE_EXPR
        and RROTATE_EXPR.
  
        * tree-pretty-print.c (op_symbol): Handle LROTATE_EXPR
        and RROTATE_EXPR.
  
index beebf04..ece3637 100644 (file)
@@ -420,7 +420,7 @@ convert_to_integer (tree type, tree expr)
       expr = fold_build1 (CONVERT_EXPR,
                          lang_hooks.types.type_for_size (POINTER_SIZE, 0),
                          expr);
       expr = fold_build1 (CONVERT_EXPR,
                          lang_hooks.types.type_for_size (POINTER_SIZE, 0),
                          expr);
-      return fold_build1 (NOP_EXPR, type, expr);
+      return fold_convert (type, expr);
 
     case INTEGER_TYPE:
     case ENUMERAL_TYPE:
 
     case INTEGER_TYPE:
     case ENUMERAL_TYPE:
@@ -500,9 +500,7 @@ convert_to_integer (tree type, tree expr)
          /* We can pass truncation down through right shifting
             when the shift count is a nonpositive constant.  */
          if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
          /* We can pass truncation down through right shifting
             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),
-                                 convert (TREE_TYPE (TREE_OPERAND (expr, 1)),
-                                          integer_one_node)))
+             && tree_int_cst_sgn (TREE_OPERAND (expr, 1)) < 0)
            goto trunc1;
          break;
 
            goto trunc1;
          break;
 
@@ -528,7 +526,7 @@ convert_to_integer (tree type, tree expr)
                     but (int) a << 32 is undefined and would get a
                     warning.  */
 
                     but (int) a << 32 is undefined and would get a
                     warning.  */
 
-                 tree t = convert_to_integer (type, integer_zero_node);
+                 tree t = build_int_cst (type, 0);
 
                  /* If the original expression had side-effects, we must
                     preserve it.  */
 
                  /* If the original expression had side-effects, we must
                     preserve it.  */