From 2a6b4c77546b2f5d0214730c3247184a3986bde5 Mon Sep 17 00:00:00 2001 From: sayle Date: Mon, 5 Feb 2007 19:10:44 +0000 Subject: [PATCH] * fold-const.c (fold_unary) : Test for availability of BUILT_IN_COS before simplifying REAL_PART(CEXPI)) to COS. : Likewise, check for availability of BUILT_IN_SIN. * builtins.c (fold_builtin_sincos): Check for TARGET_C99_FUNCTIONS before canonicalizing sincos to cexpi. (fold_builtin_cexp): Likewise, for canonicalizing cexp to cexpi. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121607 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/builtins.c | 4 ++++ gcc/fold-const.c | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec8b633..a712429 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2007-02-05 Roger Sayle + * fold-const.c (fold_unary) : Test for availability of + BUILT_IN_COS before simplifying REAL_PART(CEXPI)) to COS. + : Likewise, check for availability of BUILT_IN_SIN. + * builtins.c (fold_builtin_sincos): Check for TARGET_C99_FUNCTIONS + before canonicalizing sincos to cexpi. + (fold_builtin_cexp): Likewise, for canonicalizing cexp to cexpi. + +2007-02-05 Roger Sayle + * config/alpha/alpha.c (alpha_add_builtins): New Helper function. Set TREE_READONLY and TREE_NOTHROW directly, not via attributes. (alpha_init_builtins): Use alpha_add_builtins to process tables. diff --git a/gcc/builtins.c b/gcc/builtins.c index b7ff782..8e9d9e4 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7474,6 +7474,8 @@ fold_builtin_sincos (tree arglist) return res; /* Canonicalize sincos to cexpi. */ + if (!TARGET_C99_FUNCTIONS) + return NULL_TREE; fn = mathfn_built_in (type, BUILT_IN_CEXPI); if (!fn) return NULL_TREE; @@ -7507,6 +7509,8 @@ fold_builtin_cexp (tree arglist, tree type) /* In case we can figure out the real part of arg0 and it is constant zero fold to cexpi. */ + if (!TARGET_C99_FUNCTIONS) + return NULL_TREE; ifn = mathfn_built_in (rtype, BUILT_IN_CEXPI); if (!ifn) return NULL_TREE; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ee2c469..c147efa 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7769,9 +7769,13 @@ fold_unary (enum tree_code code, tree type, tree op0) { CASE_FLT_FN (BUILT_IN_CEXPI): fn = mathfn_built_in (type, BUILT_IN_COS); - return build_function_call_expr (fn, TREE_OPERAND (arg0, 1)); + if (fn) + return build_function_call_expr (fn, + TREE_OPERAND (arg0, 1)); + break; - default:; + default: + break; } } return NULL_TREE; @@ -7808,9 +7812,13 @@ fold_unary (enum tree_code code, tree type, tree op0) { CASE_FLT_FN (BUILT_IN_CEXPI): fn = mathfn_built_in (type, BUILT_IN_SIN); - return build_function_call_expr (fn, TREE_OPERAND (arg0, 1)); + if (fn) + return build_function_call_expr (fn, + TREE_OPERAND (arg0, 1)); + break; - default:; + default: + break; } } return NULL_TREE; -- 2.7.4