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

MATCH: [PR111282] Simplify `a & (b ^ ~a)` to `a & b`

While `a & (b ^ ~a)` is optimized to `a & b` on the rtl level,
it is always good to optimize this at the gimple level and allows
us to match a few extra things including where a is a comparison.

Note I had to update/change the testcase and-1.c to avoid matching
this case as we can match -2 and 1 as bitwise inversions.

	PR tree-optimization/111282

gcc/ChangeLog:

	* match.pd (`a & ~(a ^ b)`, `a & (a == b)`,
	`a & ((~a) ^ b)`): New patterns.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/and-1.c: Update testcase to avoid
	matching `~1 & (a ^ 1)` simplification.
	* gcc.dg/tree-ssa/bitops-6.c: New test.
parent acfca27e
No related branches found
No related tags found
No related merge requests found
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