https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86029

--- Comment #5 from Tavian Barnes <tavianator at gmail dot com> ---
(In reply to Zsolt from comment #3)
> What is the difference between gcc's and clang's __mulsc3?

The important difference is that Clang (and GCC trunk) expand the fastpath
inline, and fall back on __mulsc3 for the more complicated cases.  So instead
of

    complex float a = b * c;

expanding to

    complex float a = __mulsc3(crealf(b), cimagf(b), crealf(c), cimagf(c));

it's more like

    complex float a = (crealf(b)*crealf(c) - cimagf(b)*cimagf(c) +
I*(crealf(b)*cimagf(c) + cimagf(b)*crealf(c));
    if (isunordered(crealf(a), cimagf(a))) {
        a = __mulsc3(crealf(b), cimagf(b), crealf(c), cimagf(c));
    }

The fastpath and unlikely branch tends to be faster than the function call.

Reply via email to