This is the mail archive of the gcc-patches@gcc.gnu.org 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 PR30028, fold sin, cos to sincos on the tree-level



Sure, I need to do _something_ anyway because of the cost issue.  The
current code will happily transform

 if (a)
   s = sin (x);
 else
   c = cos (x);

to use sincos.

This may actually not be too expensive at all with a serious implementation of sincos (i.e. fsincos, or one that vectorizes the calculation of sin and cos). But I think it's better to first get the low-hanging fruit right (i.e. sin and cos in the same basic block).


Probably not (all real-world testcases I looked at have sin and cos in
the same BB only). But the tree-ssa-math-opts pass is run after tree-loop, so too late for PRE to clean up. Was there any reason for
this? If not I'd move it at least before loop.

The reason is that LIM performs reciprocal hoisting on its own.


tree-ssa-math-opts.c is named like this because it is a relatively small pass. It may include more passes (cse reciprocals running after loop, cse sin/cos running before loop, etc.). That the two CSEs have different gate functions means that separating the passes might actually *improve* compilation time with some option combinations.

Paolo


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