[Bug tree-optimization/126466] [17 Regression] popcount recognition doesn't validate one of the masks since r17-489
"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]> Mon, 03 Aug 2026 11:24:53 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126466 --- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Venkataramanan Kumar <[email protected]>: https://gcc.gnu.org/g:7decbb57670c3c0f6136be00456fe9c8a41f7aed commit r17-2897-g7decbb57670c3c0f6136be00456fe9c8a41f7aed Author: Reshma Roy <[email protected]> Date: Thu Jul 30 12:19:08 2026 +0530 match: Fix incorrect identification of POPCOUNT pattern [PR126466] This fixes r17-489-g8ca1e887847e2f, which added a third 32-bit Hacker's Delight popcount matcher. Its predicate checked compare_tree_int (@5, 0x0F0F0F0F) twice and never validated the final outer AND constant (@7), so any mask was accepted once the earlier constants matched. Require compare_tree_int (@7, 0x0000003F) so only the intended popcount idiom is folded to IFN_POPCOUNT. gcc/ChangeLog: PR tree-optimization/126466 * match.pd: Fix incorrect POPCOUNT identification in the third 32-bit Hacker's Delight matcher. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/popcount10.c: New test.=