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

--- 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:29370f1387274ad5a35a020db6a5d06c0324e6c1

commit r14-2952-g29370f1387274ad5a35a020db6a5d06c0324e6c1
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Jul 31 14:44:52 2023 +0200

    tree-optimization/110838 - vectorization of widened shifts

    The following makes sure to limit the shift operand when vectorizing
    (short)((int)x >> 31) via (short)x >> 31 as the out of bounds shift
    operand otherwise invokes undefined behavior.  When we determine
    whether we can demote the operand we know we at most shift in the
    sign bit so we can adjust the shift amount.

    Note this has the possibility of un-CSEing common shift operands
    as there's no good way to share pattern stmts between patterns.
    We'd have to separately pattern recognize the definition.

            PR tree-optimization/110838
            * tree-vect-patterns.cc (vect_recog_over_widening_pattern):
            Adjust the shift operand of RSHIFT_EXPRs.

            * gcc.dg/torture/pr110838.c: New testcase.

Reply via email to