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
This commit is contained in:
Uros Bizjak 2005-04-15 07:43:56 +02:00 committed by Uros Bizjak
parent 57b11c9654
commit 1c432a0c34
5 changed files with 38 additions and 2 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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)
{