aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/builtins.c
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2005-06-03 03:50:42 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2005-06-03 03:50:42 +0000
commit31a119f3ede3e46847ca7849e70407c96e04d1f3 (patch)
tree56d842dca34faa3e40f969e13617dfdbb051d690 /contrib/gcc/builtins.c
parent2554b2d12b64808f2da1a31320628c91ab16164a (diff)
downloadsrc-31a119f3ede3e46847ca7849e70407c96e04d1f3.tar.gz
src-31a119f3ede3e46847ca7849e70407c96e04d1f3.zip
Stock files.
Notes
Notes: svn path=/head/; revision=146906
Diffstat (limited to 'contrib/gcc/builtins.c')
-rw-r--r--contrib/gcc/builtins.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/gcc/builtins.c b/contrib/gcc/builtins.c
index dadb6cd41a0e..a3e069e4baca 100644
--- a/contrib/gcc/builtins.c
+++ b/contrib/gcc/builtins.c
@@ -1708,6 +1708,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
narg = save_expr (arg);
if (narg != arg)
{
+ arg = narg;
arglist = build_tree_list (NULL_TREE, arg);
exp = build_function_call_expr (fndecl, arglist);
}
@@ -1840,6 +1841,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
narg = save_expr (arg1);
if (narg != arg1)
{
+ arg1 = narg;
temp = build_tree_list (NULL_TREE, narg);
stable = false;
}
@@ -1849,6 +1851,7 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
narg = save_expr (arg0);
if (narg != arg0)
{
+ arg0 = narg;
arglist = tree_cons (NULL_TREE, narg, temp);
stable = false;
}
@@ -6581,7 +6584,7 @@ fold_builtin (tree exp)
return build_function_call_expr (expfn, arglist);
}
- /* Optimize sqrt(pow(x,y)) = pow(x,y*0.5). */
+ /* Optimize sqrt(pow(x,y)) = pow(|x|,y*0.5). */
if (flag_unsafe_math_optimizations
&& (fcode == BUILT_IN_POW
|| fcode == BUILT_IN_POWF
@@ -6590,8 +6593,11 @@ fold_builtin (tree exp)
tree powfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
tree arg0 = TREE_VALUE (TREE_OPERAND (arg, 1));
tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg, 1)));
- tree narg1 = fold (build (MULT_EXPR, type, arg1,
- build_real (type, dconsthalf)));
+ tree narg1;
+ if (!tree_expr_nonnegative_p (arg0))
+ arg0 = build1 (ABS_EXPR, type, arg0);
+ narg1 = fold (build (MULT_EXPR, type, arg1,
+ build_real (type, dconsthalf)));
arglist = tree_cons (NULL_TREE, arg0,
build_tree_list (NULL_TREE, narg1));
return build_function_call_expr (powfn, arglist);