diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2007-01-26 02:40:31 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2007-01-26 02:40:31 +0000 |
commit | 4b26d10bccf3532cfee49f09346f0c1376d9968b (patch) | |
tree | 89c8c348a9e0651724438367caf493fd2c71f690 /gcc/builtins.c | |
parent | db9c839733fa461c08576e7fbbd0e305af7fecfb (diff) | |
download | gcc-4b26d10bccf3532cfee49f09346f0c1376d9968b.zip gcc-4b26d10bccf3532cfee49f09346f0c1376d9968b.tar.gz gcc-4b26d10bccf3532cfee49f09346f0c1376d9968b.tar.bz2 |
builtins.c (fold_builtin_1): Treat ccos and ccosh as 'even' functions.
* 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.
From-SVN: r121200
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index c33cdf1..d122379 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); |