Skip to content
Snippets Groups Projects
user avatar
Andrew Pinski authored
`(a == CST) & a` can be either simplified to simplying `a == CST`
or 0 depending on the first bit of the CST.
This is an extension of the already pattern of `X & !X` and allows
us to remove the 2 xfails on gcc.dg/binop-notand1a.c and gcc.dg/binop-notand4a.c.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

	PR tree-optimization/111431

gcc/ChangeLog:

	* match.pd (`(a == CST) & a`): New pattern.

gcc/testsuite/ChangeLog:

	* gcc.dg/binop-notand1a.c: Remove xfail.
	* gcc.dg/binop-notand4a.c: Likewise.
	* gcc.c-torture/execute/pr111431-1.c: New test.
	* gcc.dg/binop-andeq1.c: New test.
	* gcc.dg/binop-andeq2.c: New test.
	* gcc.dg/binop-notand7.c: New test.
	* gcc.dg/binop-notand7a.c: New test.
0fb828af
History
Name Last commit Last update