summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 02:40:31 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-26 02:40:31 +0000
commit503733d51e176d5a1f25368e6779571f6be9bd38 (patch)
tree89c8c348a9e0651724438367caf493fd2c71f690 /gcc/builtins.c
parentced4068a806f214d43721e310d16b361e011b925 (diff)
downloadgcc-503733d51e176d5a1f25368e6779571f6be9bd38.tar.gz
* builtins.c (fold_builtin_1): Treat ccos and ccosh as 'even'
functions. * fold-const.c (negate_mathfn_p): Treat casin, casinh, catan, catanh, cproj, csin, csinh, ctan and ctanh as 'odd' functions. testsuite: * gcc.dg/builtins-20.c: Add more cases. * gcc.dg/torture/builtin-symmetric-1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121200 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index c33cdf13979..d1223795b3d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -9344,6 +9344,18 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
TREE_VALUE (arglist)));
break;
+ CASE_FLT_FN (BUILT_IN_CCOS):
+ CASE_FLT_FN (BUILT_IN_CCOSH):
+ /* These functions are "even", i.e. f(x) == f(-x). */
+ if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
+ {
+ tree narg = fold_strip_sign_ops (TREE_VALUE (arglist));
+ if (narg)
+ return build_function_call_expr (fndecl,
+ build_tree_list (NULL_TREE, narg));
+ }
+ break;
+
CASE_FLT_FN (BUILT_IN_CABS):
return fold_builtin_cabs (arglist, type, fndecl);