------- Comment #7 from rguenth at gcc dot gnu dot org 2006-12-06 09:52 ------- Ok, so my plan is to go in small steps:
- at gimplification time change calls to sincos (x, &s, &c) to calls to cexp like _Complex __typeof__(s) tmp = cexp ( { 0., x } ); s = __imag tmp; c = __real tmp; - at expansion time, transform the above back to a call to sincos. This relies on TER to make the argument of form { 0., x } visible to the expander. Alternatively do this back-transformation before going out-of-ssa. 2nd alternatively create a new (internal) builtin cexpi that takes the imaginary part of the argument only, i.e. cexpi (x) would be sincos. This at least would simplify the code. The above two should fix PR17687 on the tree level and on the rtl level where the target provides either a sane ABI to the sincos function (or an alternative) or a machine instruction (like fsincos). - inside PRE recognize sin and cos and do insertion of cexp if necessary. If we do it in the "hackish" way, simply transform sin and cos to cexp before PRE and transform back cexp to sin or cos if only the real or imaginary parts of the result is used after PRE. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30038