Commit 968fc3b6 by Richard Guenther Committed by Richard Biener

re PR middle-end/33007 (builtin lround doesn't work)

2007-08-22  Richard Guenther  <rguenther@suse.de>

	PR middle-end/33007
	* builtins.c (expand_builtin_int_roundingfn): Replace call
	argument wrapped with SAVE_EXPR directly.
	(expand_builtin_int_roundingfn_2): Likewise.

	* gcc.dg/pr33007.c: New testcase.

From-SVN: r127701
parent 3fe42b89
2007-08-22 Richard Guenther <rguenther@suse.de> 2007-08-22 Richard Guenther <rguenther@suse.de>
PR middle-end/33007
* builtins.c (expand_builtin_int_roundingfn): Replace call
argument wrapped with SAVE_EXPR directly.
(expand_builtin_int_roundingfn_2): Likewise.
2007-08-22 Richard Guenther <rguenther@suse.de>
* tree-inline.c (inlinable_function_p): Restore disregarding * tree-inline.c (inlinable_function_p): Restore disregarding
inline limits for GNU extern inline functions. inline limits for GNU extern inline functions.
......
...@@ -2516,7 +2516,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget) ...@@ -2516,7 +2516,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
enum built_in_function fallback_fn; enum built_in_function fallback_fn;
tree fallback_fndecl; tree fallback_fndecl;
enum machine_mode mode; enum machine_mode mode;
tree arg, narg; tree arg;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
gcc_unreachable (); gcc_unreachable ();
...@@ -2549,12 +2549,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget) ...@@ -2549,12 +2549,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may /* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform need to expand the argument again. This way, we will not perform
side-effects more the once. */ side-effects more the once. */
narg = builtin_save_expr (arg); CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg);
if (narg != arg)
{
arg = narg;
exp = build_call_expr (fndecl, 1, arg);
}
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
...@@ -2646,7 +2641,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget) ...@@ -2646,7 +2641,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
convert_optab builtin_optab; convert_optab builtin_optab;
rtx op0, insns; rtx op0, insns;
tree fndecl = get_callee_fndecl (exp); tree fndecl = get_callee_fndecl (exp);
tree arg, narg; tree arg;
enum machine_mode mode; enum machine_mode mode;
/* There's no easy way to detect the case we need to set EDOM. */ /* There's no easy way to detect the case we need to set EDOM. */
...@@ -2678,12 +2673,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget) ...@@ -2678,12 +2673,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may /* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform need to expand the argument again. This way, we will not perform
side-effects more the once. */ side-effects more the once. */
narg = builtin_save_expr (arg); CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg);
if (narg != arg)
{
arg = narg;
exp = build_call_expr (fndecl, 1, arg);
}
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
......
2007-08-22 Richard Guenther <rguenther@suse.de>
PR middle-end/33007
* gcc.dg/pr33007.c: New testcase.
2007-08-22 Richard Sandiford <richard@codesourcery.com> 2007-08-22 Richard Sandiford <richard@codesourcery.com>
* gcc.c-torture/execute/strcmp-1.x: Delete. * gcc.c-torture/execute/strcmp-1.x: Delete.
/* { dg-do compile } */
/* { dg-options "-O -ffast-math -ftrapping-math" } */
long
foo (int i)
{
float x;
x = i;
return __builtin_lroundf (x);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment