[Bug target/93009] [9 Regression] AVX512 FMA - wrong code generation since r265288

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 22 19:20:00 GMT 2020


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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a5ce64f7d50e2f5e66ceeb88c7601bd04f3b94ea

commit r9-8162-ga5ce64f7d50e2f5e66ceeb88c7601bd04f3b94ea
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 22 17:51:14 2020 +0100

    i386: Fix wrong-code x86 issue with avx512{f,vl} fma PR93009

    As mentioned in the PR, the following testcase is miscompiled with
avx512vl.
    The reason is that the fma *_bcst_1 define_insns have two alternatives:
    "=v,v" "0,v" "v,0" "m,m" and use the same
    vfmadd213* %3<avx512bcst>, %2, %0<sd_mask_op4>
    pattern.  If the first alternative is chosen, everything is ok, but if the
    second alternative is chosen, %2 and %0 are the same register, so instead
    of doing dest=dest*another+membcst we do dest=dest*dest+membcst.
    Now, to fix this, either we'd need separate:
      "vfmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2,
%0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}
       vfmadd213<ssemodesuffix>\t{%3<avx512bcst>, %1,
%0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3<avx512bcst>}"
    where for the second alternative, we'd just use %1 instead of %2, but
    what I think is actually cleaner is just use a single alternative and
    make the two multiplication operands commutative, which they really are.

    2020-01-15  Jakub Jelinek  <jakub@redhat.com>

        PR target/93009
        * config/i386/sse.md
        (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1,
        *<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1): Use
        just a single alternative instead of two, make operands 1 and 2
        commutative.

        * gcc.target/i386/avx512vl-pr93009.c: New test.


More information about the Gcc-bugs mailing list