]> gcc.gnu.org Git - gcc.git/commitdiff
convert.c (convert_to_real): Don't convert (float)floor(double d) to floorf((float)d).
authorDale Johannesen <dalej@apple.com>
Wed, 5 Oct 2005 17:29:41 +0000 (17:29 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Wed, 5 Oct 2005 17:29:41 +0000 (17:29 +0000)
2005-10-05  Dale Johannesen  <dalej@apple.com>

        * convert.c (convert_to_real):  Don't convert
        (float)floor(double d) to floorf((float)d).

From-SVN: r105006

gcc/ChangeLog
gcc/convert.c

index 83bc007ac08805cb4f1ff9eb9a30d048b8cd08e8..102736af024abf732b4f5c87e56acc0e71735782 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-05  Dale Johannesen  <dalej@apple.com>
+
+       * convert.c (convert_to_real):  Don't convert
+       (float)floor(double d) to floorf((float)d).
+
 2005-10-05  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * config/arm/arm.md (insv): Use gen_int_mode in more places.
index 5ddae361982ad43547b0a95d171bbf0e58a0811f..471d93db5628296b6ee31e75c5f190553de90fde 100644 (file)
@@ -200,35 +200,9 @@ convert_to_real (tree type, tree expr)
          break;
        }
     }
-  if (optimize
-      && (((fcode == BUILT_IN_FLOORL
-          || fcode == BUILT_IN_CEILL
-          || fcode == BUILT_IN_ROUNDL
-          || fcode == BUILT_IN_RINTL
-          || fcode == BUILT_IN_TRUNCL
-          || fcode == BUILT_IN_NEARBYINTL)
-         && (TYPE_MODE (type) == TYPE_MODE (double_type_node)
-             || TYPE_MODE (type) == TYPE_MODE (float_type_node)))
-         || ((fcode == BUILT_IN_FLOOR
-              || fcode == BUILT_IN_CEIL
-              || fcode == BUILT_IN_ROUND
-              || fcode == BUILT_IN_RINT
-              || fcode == BUILT_IN_TRUNC
-              || fcode == BUILT_IN_NEARBYINT)
-             && (TYPE_MODE (type) == TYPE_MODE (float_type_node)))))
-    {
-      tree fn = mathfn_built_in (type, fcode);
-
-      if (fn)
-       {
-         tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr,
-                                                                       1)));
-         tree arglist = build_tree_list (NULL_TREE,
-                                         fold (convert_to_real (type, arg0)));
-
-         return build_function_call_expr (fn, arglist);
-       }
-    }
+  /* This code formerly changed (float)floor(double d) to
+     floorf((float)d).  This is incorrect, because (float)d uses
+     round-to-nearest and can round up to the next integer. */
 
   /* Propagate the cast into the operation.  */
   if (itype != type && FLOAT_TYPE_P (type))
This page took 0.06641 seconds and 5 git commands to generate.