[Committed] Fix builtins-1.c on mips-sgi-irix6.5 (and other !TARGET_C99_FUNCTIONS targets)
Roger Sayle
roger@eyesopen.com
Mon Feb 5 22:46:00 GMT 2007
On Mon, 5 Feb 2007, Roger Sayle wrote:
> 2007-02-05 Roger Sayle <roger@eyesopen.com>
>
> * fold-const.c (fold_unary) <REAL_PART>: Test for availability of
> BUILT_IN_COS before simplifying REAL_PART(CEXPI)) to COS.
> <IMAG_PART>: 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.
Many thanks to Ian for pointing out that I managed to confuse
/tmp/patch.txt with ~/patch.txt. Doh! Senior moment. Here's the
appropriate patch via my old mailer. Sorry for the confusion.
Index: fold-const.c
===================================================================
*** fold-const.c (revision 121545)
--- fold-const.c (working copy)
*************** fold_unary (enum tree_code code, tree ty
*** 7740,7748 ****
{
CASE_FLT_FN (BUILT_IN_CEXPI):
fn = mathfn_built_in (type, BUILT_IN_COS);
! return build_function_call_expr (fn, TREE_OPERAND (arg0, 1));
! default:;
}
}
return NULL_TREE;
--- 7740,7752 ----
{
CASE_FLT_FN (BUILT_IN_CEXPI):
fn = mathfn_built_in (type, BUILT_IN_COS);
! if (fn)
! return build_function_call_expr (fn,
! TREE_OPERAND (arg0, 1));
! break;
! default:
! break;
}
}
return NULL_TREE;
*************** fold_unary (enum tree_code code, tree ty
*** 7779,7787 ****
{
CASE_FLT_FN (BUILT_IN_CEXPI):
fn = mathfn_built_in (type, BUILT_IN_SIN);
! return build_function_call_expr (fn, TREE_OPERAND (arg0, 1));
! default:;
}
}
return NULL_TREE;
--- 7783,7795 ----
{
CASE_FLT_FN (BUILT_IN_CEXPI):
fn = mathfn_built_in (type, BUILT_IN_SIN);
! if (fn)
! return build_function_call_expr (fn,
! TREE_OPERAND (arg0, 1));
! break;
! default:
! break;
}
}
return NULL_TREE;
Index: builtins.c
===================================================================
*** builtins.c (revision 121545)
--- builtins.c (working copy)
*************** fold_builtin_sincos (tree arglist)
*** 7475,7480 ****
--- 7475,7482 ----
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;
*************** fold_builtin_cexp (tree arglist, tree ty
*** 7508,7513 ****
--- 7510,7517 ----
/* 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;
Roger
--
More information about the Gcc-patches
mailing list