This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR17687 sincos -> cexp canonicalization (2nd try)

On Tue, 12 Dec 2006, Richard Guenther wrote:

> On Fri, 8 Dec 2006, Richard Guenther wrote:
> > 
> > This moves canonicalization from gimplify to fold as requested and
> > adds folding of cexp as well (as requested).  To produce a testcase
> > for the latter I had to add some folding of complex expressions to
> > allow making cexp with an imaginary argument visible to fold.  Also
> > gcc.c-torture/execute/complex-1.c needs adjustment because it defines
> > its own cexp with different semantics.
> Here's just the canonicalization part again (I don't like big patches).
> There's the point that from fold_builtin_sincos we generate a MODIFY_EXPR
> which will ICE if we ever do so after gimplification.  So I still believe
> this transformation belongs to the gimplifier - even a pass doing proper
> gimplification on a folded tree will hit the ICE as we have in build2
>   if (code == MODIFY_EXPR && cfun && cfun->gimplified)
>     {
>       /* We should be talking GIMPLE_MODIFY_STMT by now.  */
>       gcc_unreachable ();
>     }
> which is IMHO broken.  This is more for verify_stmts.
> I believe this patch is certainly non-algorithmic, but for the above
> reason I'd like to have an opinion whether the fold or the gimplify
> variant is what we want.

Applied to mainline.  The above problem is harmless as no pass currently
generates calls to sincos.


> 2006-12-06  Richard Guenther  <>
> 	PR tree-optimization/17687
> 	New builtins for imaginary argument cexp.
> 	* builtin-types.def (BT_FN_COMPLEX_FLOAT_FLOAT,
> 	New required builtin types.
> 	* builtins.c (expand_builtin_cexpi): Declare.
> 	(mathfn_built_in): Handle BUILT_IN_CEXPI.
> 	(expand_builtin_cexpi): New static helper.
> 	(expand_builtin): Call it.
> 	(do_mpfr_sincos): Adjust for CEXPI evaluation.
> 	(fold_builtin_sincos): New function to fold sincos to cepxi.
> 	* testsuite/gcc.dg/builtins-59.c: New testcase.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]