gnu/gcc/7decbb57670c3c0f6136be00456fe9c8a41f7aed 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.
2 files changed