From 4b26d10bccf3532cfee49f09346f0c1376d9968b Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Fri, 26 Jan 2007 02:40:31 +0000 Subject: 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 --- gcc/builtins.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/builtins.c') 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); -- cgit v1.1