OSDN Git Service

(fold, case CONVERT_EXPR): Don't merge conversions if outer is to
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jul 1995 23:02:49 +0000 (23:02 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Jul 1995 23:02:49 +0000 (23:02 +0000)
handle a type with differing precision.

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

gcc/fold-const.c

index 4c86dac..8c35dc4 100644 (file)
@@ -3445,11 +3445,14 @@ fold (expr)
             float or both integer, we don't need the middle conversion if
             it is wider than the final type and doesn't change the signedness
             (for integers).  Avoid this if the final type is a pointer
-            since then we sometimes need the inner conversion.  */
+            since then we sometimes need the inner conversion.  Likewise if
+            the outer has a precision not equal to the size of its mode.  */
          if ((((inter_int || inter_ptr) && (inside_int || inside_ptr))
               || (inter_float && inside_float))
              && inter_prec >= inside_prec
              && (inter_float || inter_unsignedp == inside_unsignedp)
+             && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
+                   && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
              && ! final_ptr)
            return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
 
@@ -3471,7 +3474,10 @@ fold (expr)
              && ((inter_unsignedp && inter_prec > inside_prec)
                  == (final_unsignedp && final_prec > inter_prec))
              && ! (inside_ptr && inter_prec != final_prec)
-             && ! (final_ptr && inside_prec != inter_prec))
+             && ! (final_ptr && inside_prec != inter_prec)
+             && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (final_type))
+                   && TYPE_MODE (final_type) == TYPE_MODE (inter_type))
+             && ! final_ptr)
            return convert (final_type, TREE_OPERAND (TREE_OPERAND (t, 0), 0));
        }