aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2006-11-11 04:05:14 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2006-11-11 04:05:14 +0000
commitb81e7144aa0c032c6246e0962467b4284cacd234 (patch)
treed6296e3b6e9ca4e372d936e1dd953fec297ffde3 /gcc/fold-const.c
parent345768ef3f0ad0f2b09cbd79ec4daf6ba48f51b7 (diff)
downloadgcc-b81e7144aa0c032c6246e0962467b4284cacd234.zip
gcc-b81e7144aa0c032c6246e0962467b4284cacd234.tar.gz
gcc-b81e7144aa0c032c6246e0962467b4284cacd234.tar.bz2
builtins.c (fold_builtin_cos): Use fold_strip_sign_ops().
* builtins.c (fold_builtin_cos): Use fold_strip_sign_ops(). (fold_builtin_hypot): Likewise. * fold-const.c (fold_strip_sign_ops): Handle "odd" builtins. testsuite: * gcc.dg/builtins-20.c: Add more cases for stripping sign ops. From-SVN: r118683
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fedc3ca..7c769d5 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13296,6 +13296,17 @@ fold_strip_sign_ops (tree exp)
arg1 ? arg1 : TREE_OPERAND (exp, 1));
break;
+ case CALL_EXPR:
+ /* Strip sign ops from the argument of "odd" math functions. */
+ if (negate_mathfn_p (builtin_mathfn_code (exp)))
+ {
+ arg0 = fold_strip_sign_ops (TREE_VALUE (TREE_OPERAND (exp, 1)));
+ if (arg0)
+ return build_function_call_expr (get_callee_fndecl (exp),
+ build_tree_list (NULL_TREE, arg0));
+ }
+ break;
+
default:
break;
}