[Bug tree-optimization/70291] muldc3 code generation could be smarter
wilco at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 15 14:21:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70291
Wilco <wilco at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wilco at gcc dot gnu.org
--- Comment #2 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Ramana Radhakrishnan from comment #0)
> __complex double x;
> __complex double y;
> __complex double z;
> double a, b, c, d;
>
> int main (void)
> {
> x = y * z;
> return 0;
> }
>
> Could well be implemented as:
>
>
> int main (void)
> {
> x = y * z;
> if (isnan (__real x) && isnan (__imag__ x))
> x = __muldc3 (y, z);
>
> return 0;
> }
>
> essentially opencoding this as the standard suggests in G.5.1 => 6for C99.
>
> spotted while looking at profiles that were reported on aarch64 with code
> compiled at O2 / O3.
>
> I note that lowering this in this form in tree-complex.c will need a bit of
> book-keeping given that it's sort of bounded on the phi nodes and ssa_names
> before lowering begins but this could well be another math-optimization done
> later rather than munging it with the existing lowering.
Note that isnan (x) || isnan (y) is optimized to isunordered (x, y), so that
would be a faster check.
Also it may be beneficial to vectorize this despite the fallback.
More information about the Gcc-bugs
mailing list