[Bug tree-optimization/125707] (~a)>>a should be simplified into -1 for signed types
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jun 13 03:04:24 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125707
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:b3ade4e315e5bab56eced1e22eceabbf1a8f15c4
commit r17-1527-gb3ade4e315e5bab56eced1e22eceabbf1a8f15c4
Author: Kael Andrew Alonzo Franco <kaelfandrew@gmail.com>
Date: Fri Jun 12 05:55:56 2026 -0400
match: Optimize (~a) >> a to -1 for signed a [PR125707]
For signed a, (~a) >> a is the same as ~(a>>a) which is ~0 aka -1.
Bootstrapped and tested on x86_64-pc-linux-gnu
PR tree-optimization/125707
gcc/ChangeLog:
PR tree-optimization/125707
* match.pd: Add (~a) >> a to -1 for signed a.
gcc/testsuite/ChangeLog:
PR tree-optimization/125707
* gcc.dg/pr125707.c: New test.
Signed-off-by: Kael Franco <kaelfandrew@gmail.com>
More information about the Gcc-bugs
mailing list