From 5799f73221dddf783210a43c6a6eeb75afe10efd Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Thu, 23 Aug 2007 13:18:37 +0000 Subject: [PATCH] builtins.c (expand_builtin_mathfn): Wrap argument in save_expr directly instead of re-building the call. 2007-08-23 Richard Guenther * builtins.c (expand_builtin_mathfn): Wrap argument in save_expr directly instead of re-building the call. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_int_roundingfn): Set arg. (expand_builtin_int_roundingfn_2): Likewise. From-SVN: r127740 --- gcc/ChangeLog | 10 ++++++++++ gcc/builtins.c | 51 +++++++++++---------------------------------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8c7a21..fbfee2b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2007-08-23 Richard Guenther + + * builtins.c (expand_builtin_mathfn): Wrap argument in + save_expr directly instead of re-building the call. + (expand_builtin_mathfn_2): Likewise. + (expand_builtin_mathfn_3): Likewise. + (expand_builtin_interclass_mathfn): Likewise. + (expand_builtin_int_roundingfn): Set arg. + (expand_builtin_int_roundingfn_2): Likewise. + 2007-08-23 Paolo Bonzini * config/i386/sse.md (*sse_and3, *sse_ior3, diff --git a/gcc/builtins.c b/gcc/builtins.c index 64f8185..2814d30 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1813,7 +1813,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) tree fndecl = get_callee_fndecl (exp); enum machine_mode mode; bool errno_set = false; - tree arg, narg; + tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) return NULL_RTX; @@ -1886,12 +1886,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) /* 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 side-effects more the once. */ - narg = builtin_save_expr (arg); - if (narg != arg) - { - arg = narg; - exp = build_call_expr (fndecl, 1, arg); - } + CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); @@ -1979,10 +1974,9 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) rtx op0, op1, insns; int op1_type = REAL_TYPE; tree fndecl = get_callee_fndecl (exp); - tree arg0, arg1, narg; + tree arg0, arg1; enum machine_mode mode; bool errno_set = true; - bool stable = true; switch (DECL_FUNCTION_CODE (fndecl)) { @@ -2039,21 +2033,8 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) errno_set = false; /* Always stabilize the argument list. */ - narg = builtin_save_expr (arg1); - if (narg != arg1) - { - arg1 = narg; - stable = false; - } - narg = builtin_save_expr (arg0); - if (narg != arg0) - { - arg0 = narg; - stable = false; - } - - if (! stable) - exp = build_call_expr (fndecl, 2, arg0, arg1); + CALL_EXPR_ARG (exp, 0) = arg0 = builtin_save_expr (arg0); + CALL_EXPR_ARG (exp, 1) = arg1 = builtin_save_expr (arg1); op0 = expand_expr (arg0, subtarget, VOIDmode, EXPAND_NORMAL); op1 = expand_normal (arg1); @@ -2099,7 +2080,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) rtx op0, insns; tree fndecl = get_callee_fndecl (exp); enum machine_mode mode; - tree arg, narg; + tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) return NULL_RTX; @@ -2139,12 +2120,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget) /* 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 side-effects more the once. */ - narg = save_expr (arg); - if (narg != arg) - { - arg = narg; - exp = build_call_expr (fndecl, 1, arg); - } + CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); @@ -2211,7 +2187,7 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget) tree fndecl = get_callee_fndecl (exp); enum machine_mode mode; bool errno_set = false; - tree arg, narg; + tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) return NULL_RTX; @@ -2257,12 +2233,7 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget) /* 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 side-effects more the once. */ - narg = builtin_save_expr (arg); - if (narg != arg) - { - arg = narg; - exp = build_call_expr (fndecl, 1, arg); - } + CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); @@ -2549,7 +2520,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget) /* 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 side-effects more the once. */ - CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg); + CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); @@ -2673,7 +2644,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 need to expand the argument again. This way, we will not perform side-effects more the once. */ - CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg); + CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg); op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL); -- 2.7.4