aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@kss-loka.si>2005-04-15 07:43:56 +0200
committerUros Bizjak <uros@gcc.gnu.org>2005-04-15 07:43:56 +0200
commit1c432a0c34a7f3ac56afca802e1dce1058be2db5 (patch)
tree6cece628e71c04ff9e27b7ef90ee01ffb2ef5922
parent57b11c96547894d67972735a5df66fb9c7fdacdb (diff)
downloadgcc-1c432a0c34a7f3ac56afca802e1dce1058be2db5.zip
gcc-1c432a0c34a7f3ac56afca802e1dce1058be2db5.tar.gz
gcc-1c432a0c34a7f3ac56afca802e1dce1058be2db5.tar.bz2
re PR tree-optimization/21004 (gcc.dg/builtins-53.c fails)
PR tree-optimization/21004 * convert.c (convert_to_integer): Convert ceilf, ceill, floorf and floorl in c99 mode only. * builtins.c (expand_builtin_int_roundingfn): Assert that fallback_fndecl is not NULL_TREE. testsuite: PR tree-optimization/21004 * gcc.dg/builtins-53.c: Include builtins-config.h. Check floorf, ceilf, floorl and ceill transformations only when HAVE_C99_RUNTIME is defined. From-SVN: r98174
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/builtins.c3
-rw-r--r--gcc/convert.c16
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/builtins-53.c6
5 files changed, 38 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2aaf517..e30430b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2005-04-15 Uros Bizjak <uros@kss-loka.si>
+
+ PR tree-optimization/21004
+ * convert.c (convert_to_integer): Convert ceilf, ceill, floorf
+ and floorl in c99 mode only.
+ * builtins.c (expand_builtin_int_roundingfn): Assert that
+ fallback_fndecl is not NULL_TREE.
+
2005-04-15 Kazu Hirata <kazu@cs.umass.edu>
* cfgrtl.c (purge_all_dead_edge): Remove an unused argument.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1a54a06..78a577f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2220,6 +2220,9 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
/* Fall back to floating point rounding optab. */
fallback_fndecl = mathfn_built_in (TREE_TYPE (arg), fallback_fn);
+ /* We shouldn't get here on targets without TARGET_C99_FUNCTIONS.
+ ??? Perhaps convert (int)floorf(x) into (int)floor((double)x). */
+ gcc_assert (fallback_fndecl != NULL_TREE);
exp = build_function_call_expr (fallback_fndecl, arglist);
tmp = expand_builtin_mathfn (exp, NULL_RTX, NULL_RTX);
diff --git a/gcc/convert.c b/gcc/convert.c
index 4e0fc84..c6c2620 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -349,14 +349,26 @@ convert_to_integer (tree type, tree expr)
switch (fcode)
{
- case BUILT_IN_CEIL: case BUILT_IN_CEILF: case BUILT_IN_CEILL:
+ case BUILT_IN_CEILF:
+ case BUILT_IN_CEILL:
+ /* Only convert in ISO C99 mode. */
+ if (!TARGET_C99_FUNCTIONS)
+ break;
+ /* ... Fall through ... */
+ case BUILT_IN_CEIL:
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node))
fn = mathfn_built_in (s_intype, BUILT_IN_LLCEIL);
else
fn = mathfn_built_in (s_intype, BUILT_IN_LCEIL);
break;
- case BUILT_IN_FLOOR: case BUILT_IN_FLOORF: case BUILT_IN_FLOORL:
+ case BUILT_IN_FLOORF:
+ case BUILT_IN_FLOORL:
+ /* Only convert in ISO C99 mode. */
+ if (!TARGET_C99_FUNCTIONS)
+ break;
+ /* ... Fall through ... */
+ case BUILT_IN_FLOOR:
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (long_long_integer_type_node))
fn = mathfn_built_in (s_intype, BUILT_IN_LLFLOOR);
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5d78e17..b2b8e97 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-15 Uros Bizjak <uros@kss-loka.si>
+
+ PR tree-optimization/21004
+ * gcc.dg/builtins-53.c: Include builtins-config.h.
+ Check floorf, ceilf, floorl and ceill transformations
+ only when HAVE_C99_RUNTIME is defined.
+
2005-04-15 Alexandre Oliva <aoliva@redhat.com>
PR middle-end/20739
diff --git a/gcc/testsuite/gcc.dg/builtins-53.c b/gcc/testsuite/gcc.dg/builtins-53.c
index 0a08070..e01908c 100644
--- a/gcc/testsuite/gcc.dg/builtins-53.c
+++ b/gcc/testsuite/gcc.dg/builtins-53.c
@@ -11,6 +11,8 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math" } */
+#include "builtins-config.h"
+
extern double floor(double);
extern double ceil(double);
extern double trunc(double);
@@ -54,6 +56,7 @@ long long int test6(double x)
return trunc(x);
}
+#ifdef HAVE_C99_RUNTIME
long int test1f(float x)
{
return floorf(x);
@@ -73,6 +76,7 @@ long long int test4f(float x)
{
return ceilf(x);
}
+#endif
long int test5f(float x)
{
@@ -84,6 +88,7 @@ long long int test6f(float x)
return truncf(x);
}
+#ifdef HAVE_C99_RUNTIME
long int test1l(long double x)
{
return floorl(x);
@@ -103,6 +108,7 @@ long long int test4l(long double x)
{
return ceill(x);
}
+#endif
long int test5l(long double x)
{