On September 13, 2018 4:32:42 PM GMT+02:00, Alexander Monakov <amona...@ispras.ru> wrote: >On Thu, 13 Sep 2018, Wilco Dijkstra wrote: >> What do people think? Ideally I'd like to support this in a generic >way so all targets can >> benefit, but it's also feasible to enable it on a per-target basis. >Also since not all libraries >> will support the new interface, there would have to be a flag or >configure option to switch >> the new interface off if not supported (maybe automatically based on >the math.h header). > >GCC already has __builtin_cexpi for this, so I think you can introduce >cexpi >implementation in libc, and then adjust expand_builtin_cexpi >appropriately.
Note currently we expand that to sincos (if available) or cexp. We use it for canonicalization and better optimization on GIMPLE (register promoting the pointed to vars). >I wonder if it would be possible to add a fallback cexpi implementation >to >libgcc.a that would be picked by the linker if there's no such symbol >in libm? That would probably be a requirement. Richard. > >Alexander