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

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:70c50c87273d940918225d5c6b03f1ccfb6f978e

commit r14-3337-g70c50c87273d940918225d5c6b03f1ccfb6f978e
Author: Andrew Pinski <apin...@marvell.com>
Date:   Mon Aug 14 18:35:53 2023 -0700

    MATCH: Sink convert for vec_cond

    Convert be sinked into a vec_cond if both sides
    fold. Unlike other unary operations, we need to check that we still can
handle
    this vec_cond's first operand is the same as the new truth type.

    I tried a few different versions of this patch:
    view_convert to the new truth_type but that does not work as we always
support all vec_cond
    afterwards.
    using expand_vec_cond_expr_p; but that would allow too much.

    I also tried to see if view_convert can be handled here but we end up with:
      _3 = VEC_COND_EXPR <_2, {  Nan(-1),  Nan(-1),  Nan(-1),  Nan(-1) }, {
0.0, 0.0, 0.0, 0.0 }>;
    Which isel does not know how to handle as just being a view_convert from
`vector(4) <signed-boolean:32>`
    to `vector(4) float` and causes a regression with
`g++.target/i386/pr88152.C`

    Note, in the case of the SVE testcase, we will sink negate after the
convert and be able
    to remove a few extra instructions in the end.
    Also with this change gcc.target/aarch64/sve/cond_unary_5.c will now pass.

    Committed as approved after a bootstrapped and tested on x86_64-linux-gnu
and aarch64-linux-gnu.

    gcc/ChangeLog:

            PR tree-optimization/111006
            PR tree-optimization/110986
            * match.pd: (op(vec_cond(a,b,c))): Handle convert for op.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/111006
            * gcc.target/aarch64/sve/cond_convert_7.c: New test.

Reply via email to