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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:9f8f37f5490076b10436993fb90d18092a960922

commit r14-2699-g9f8f37f5490076b10436993fb90d18092a960922
Author: Richard Biener <rguent...@suse.de>
Date:   Thu Jul 13 08:58:58 2023 +0200

    tree-optimization/88540 - FP x > y ? x : y if-conversion without
-ffast-math

    The following makes sure that FP x > y ? x : y style max/min operations
    are if-converted at the GIMPLE level.  While we can neither match
    it to MAX_EXPR nor .FMAX as both have different semantics with IEEE
    than the ternary ?: operation we can make sure to maintain this form
    as a COND_EXPR so backends have the chance to match this to instructions
    their ISA offers.

    The patch does this in phiopt where we recognize min/max and instead
    of giving up when we have to honor NaNs we alter the generated code
    to a COND_EXPR.

    This resolves PR88540 and we can then SLP vectorize the min operation
    for its testcase.  It also resolves part of the regressions observed
    with the change matching bit-inserts of bit-field-refs to vec_perm.

    Expansion from a COND_EXPR rather than from compare-and-branch
    gcc.target/i386/pr54855-9.c by producing extra moves while the
    corresponding min/max operations are now already synthesized by
    RTL expansion, register selection isn't optimal.  This can be also
    provoked without this change by altering the operand order in the source.
    I have XFAILed that part of the test.

            PR tree-optimization/88540
            * tree-ssa-phiopt.cc (minmax_replacement): Do not give up
            with NaNs but handle the simple case by if-converting to a
            COND_EXPR.

            * gcc.target/i386/pr88540.c: New testcase.
            * gcc.target/i386/pr54855-9.c: XFAIL check for redundant moves.
            * gcc.target/i386/pr54855-12.c: Adjust.
            * gcc.target/i386/pr54855-13.c: Likewise.
            * gcc.target/i386/pr110170.c: Likewise.
            * gcc.dg/tree-ssa/split-path-12.c: Likewise.

Reply via email to