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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

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

commit r10-7543-ga13d6ec867e750169af95649235a6681f410464a
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Apr 3 20:33:17 2020 +0200

    i386: Fix up handling of OPTION_MASK_ISA_MMX builtins [PR94461]

    In https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00576.html the builtin
    handling was changed so that OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE
    etc. in i386-builtin.def means we require both mmx and sse, not just one of
    those, and later on for other option combinations very similar rule has
    been clarified, with a few exceptions that ix86_expand_builtin lists
    (SSE | 3DNOW_A, SSE4_2 | CRC32 and FMA | FMA4 are one or the other).
    The above mentioned patch also added OPTION_MASK_ISA_MMX to a few insns
    that in the ISA documents are documented e.g. only requiring SSE2 or SSSE3
    etc. CPUID, but because those builtins take or return V2SI or similar
    MMX-ish arguments, we can't really support those builtins in functions that
    have MMX disabled.
    Now, during the TARGET_MMX_WITH_SSE changes,
    https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01479.html
    and
    https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01084.html
    actually changed this; it added | OPTION_MASK_ISA_SSE2 to builtins
    that were formerly OPTION_MASK_ISA_MMX only, but didn't touch the builtins
    that were already using OPTION_MASK_ISA_SSE2 | OPTION_MASK_ISA_MMX
    for something different (both options must be enabled).
    This causes e.g. ICE on the following testcase, because the builtins are
    now enabled even with just -mmmx -mno-sse2, even when they (those changed
in
    2017) require SSE2.
    The following patch instead reverts the above two 2019-ish changes (except
    for header/testsuite changes), and instead treats OPTION_MASK_ISA_MMX
    requirement in bdesc/.isa specially, as being satisfied by either
    TARGET_MMX (no changes really needed for that), or by TARGET_MMX_WITH_SSE.
    This achieves what the two 2019-ish patches want to do, that the
    OPTION_MASK_ISA_MMX only builtins are enabled not just with -mmmx, but also
    with -m64 -msse2, and for the other builtins that require MMX and something
    else will either require -mmmx and that some other ISA, or -m64 -msse2 and
    that other ISA, but -mmmx will not enable builtins that need something more
    than OPTION_MASK_ISA_MMX only.
    The i386-builtins.c changes that aren't reversion of the two patches try to
    make sure that in .isa we still record OPTION_MASK_ISA_MMX for builtins
that
    have that requirement, so that it is in the end only ix86_expand_builtin
    that decides if the builtin is ok or not and the rest of code just decides
    if it is the right time to declare the builtin already or if it should be
    deferred.

    2020-04-03  Jakub Jelinek  <ja...@redhat.com>

            PR target/94461
            * config/i386/i386-expand.c (ix86_expand_builtin): If
            TARGET_MMX_WITH_SSE without TARGET_MMX and bisa contains
            OPTION_MASK_ISA_MMX, clear OPTION_MASK_ISA_MMX and set
            OPTION_MASK_ISA_SSE2 in bisa.  Revert 2019-05-17 and 2019-05-15
            changes.
            * config/i386/i386-builtins.c (def_builtin): If mask includes
            OPTION_MASK_ISA_MMX and TARGET_MMX_WITH_SSE, consider it satisfied.
            (ix86_add_new_builtins): For TARGET_64BIT, consider
            OPTION_MASK_ISA_SSE2 enabled in isa as satisfying
OPTION_MASK_ISA_MMX
            requirement.
            (ix86_init_tm_builtins): If TARGET_MMX_WITH_SSE consider
            OPTION_MASK_ISA_MMX as satisfied.
            (bdesc_tm): Revert 2019-05-15 changes.
            (ix86_init_mmx_sse_builtins): Likewise.
            * config/i386/i386-builtin.def: Likewise.

            * gcc.target/i386/pr94461.c: New test.

Reply via email to