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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <[email protected]>:

https://gcc.gnu.org/g:1b89220ec6f77afff3d9ef39a91a6cd821e3d2da

commit r17-7015-g1b89220ec6f77afff3d9ef39a91a6cd821e3d2da
Author: liuhongt <[email protected]>
Date:   Mon Nov 9 01:09:22 2026 -0800

    x86: Cost UNSPEC_SSE_MOVCC by its split form in if-conversion

    default_noce_conversion_profitable_p uses the parallel cost only when
    every insn costs COSTS_N_INSNS (1).  UNSPEC_SSE_MOVCC costs three, so
    a block with FP and integer selects on the same condition is costed
    serially and may not be if-converted.  Cost a copy of the sequence
    with each UNSPEC_SSE_MOVCC replaced by its and/andnot/or instead.

    Only do this for speed, and only for an UNSPEC_SSE_MOVCC with a
    register mask.  After combine the mask can be a comparison of the
    arms, which is a single min or max that ix86_rtx_costs already costs
    as one insn.

    Also remove the extra COSTS_N_INSNS (2) allowance for FP if-conversion
    without SSE4.1 in ix86_noce_conversion_profitable_p.  Now that the
    split form is costed in parallel, that allowance is no longer very
    useful.

    gcc/ChangeLog:

            PR target/115683
            PR target/128923
            * config/i386/i386.cc (ix86_sse_movcc_insn_p): New function.
            (ix86_split_sse_movcc_for_cost): New function.
            (ix86_noce_conversion_profitable_p): Cost UNSPEC_SSE_MOVCC by its
            split form.  Remove the extra allowance for floating point
            if-conversion without SSE4.1.

    gcc/testsuite/ChangeLog:

            PR target/115683
            PR target/128923
            * gcc.target/i386/sse-movcc-ifcvt-1.c: New test.
            * gcc.dg/rtl/x86_64/sse-movcc-ifcvt-minmax.c: New test.

Reply via email to