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

--- Comment #4 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:a0d732eea2e152fc51f7c5249abaa9ef56fc5121

commit r11-195-ga0d732eea2e152fc51f7c5249abaa9ef56fc5121
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri May 8 09:35:41 2020 +0200

    match.pd: Canonicalize (X + (X >> (prec - 1))) ^ (X >> (prec - 1)) to abs
(X) [PR94783]

    The following patch canonicalizes M = X >> (prec - 1); (X + M) ^ M
    for signed integral types into ABS_EXPR (X).  For X == min it is already
    UB because M is -1 and min + -1 is UB, so we can use ABS_EXPR rather than
    say ABSU_EXPR + cast.

    The backend might then emit the abs code back using the shift and addition
    and xor if it is the best sequence for the target, but could do something
    different that is better.

    2020-05-08  Jakub Jelinek  <ja...@redhat.com>

            PR tree-optimization/94783
            * match.pd ((X + (X >> (prec - 1))) ^ (X >> (prec - 1)) to abs
(X)):
            New simplification.

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

Reply via email to