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

--- Comment #6 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:11c4a06a6c1a9db0bfdb3ee8509392dd7163709c

commit r12-5305-g11c4a06a6c1a9db0bfdb3ee8509392dd7163709c
Author: Andrew Pinski <apin...@marvell.com>
Date:   Sat Nov 13 04:16:55 2021 +0000

    tree-optimization: [PR103218] Fold ((type)(a<0)) << SIGNBITOFA into
((type)a) & signbit

    This folds Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit inside
match.pd.
    This was already handled in fold-cost by:
    /* A < 0 ? <sign bit of A> : 0 is simply (A & <sign bit of A>).  */
    I have not removed as we only simplify "a ? POW2 : 0" at the gimple level
to "a << CST1"
    and fold actually does the reverse of folding "(a<0)<<CST" into "(a<0) ?
1<<CST : 0".

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

            PR tree-optimization/103218

    gcc/ChangeLog:

            * match.pd: New pattern for "((type)(a<0)) << SIGNBITOFA".

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr103218-1.c: New test.

Reply via email to