On Mon, 24 Dec 2018 at 19:16, Emilio G. Cota <c...@braap.org> wrote:
> The added branch to the FMA ops is marked as unlikely and therefore
> its impact on performance (measured with fp-bench) is within noise range
> when measured on an Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz.

> +        /* check whether avx is usable */
> +        if (c & bit_OSXSAVE) {
> +            int bv;
> +
> +            __asm("xgetbv" : "=a"(bv), "=d"(d) : "c"(0));
> +            if ((bv & 6) == 6) {
> +                has_avx = c & bit_AVX;
> +            }
> +        }

I note that the code in tcg/i386/tcg-target.inc.c
that does something similar has the note:
            /* The xgetbv instruction is not available to older versions of
             * the assembler, so we encode the instruction manually.
             */
 -- does that concern apply here?

This will also be the fourth piece of code that has an
inline xgetbv asm insn to try to query a property of the
CPU (the other 3 are target/i386/hvf/x86_cpuid.c, util/bufferiszero.c
and tcg/i386/tcg-target.inc.c), which strongly suggests that we
should abstract this out a bit better. That also might help
avoid bugs which exist in one version but not the other:
see for instance https://bugs.launchpad.net/bugs/1758819

thanks
-- PMM

Reply via email to