Skip to content
Snippets Groups Projects
Commit 0fb828af authored by Andrew Pinski's avatar Andrew Pinski
Browse files

MATCH: Add simplifications of `(a == CST) & a`

`(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.
parent 0db53311
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment