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

match: Optimize `max(a,b) == 0` to `(a|b) == 0` for unsigned [PR115275]


For unsigned types, you can optimize `max<a,b> == 0` into
`(a|b) == 0` (that is both have to be zero). A similar thing happens for `!= 0`.
This optimization fixes the missed optimization (g++.dg/tree-ssa/pr115275.C)
that was reported exposed by adding phiprop early.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/115275

gcc/ChangeLog:

	* match.pd (umax(a,b) ==/!= 0): New pattern.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/pr115275.C: New test.
	* gcc.dg/tree-ssa/max_eqne-1.c: New test.
	* gcc.dg/tree-ssa/max_eqne-2.c: New test.

Signed-off-by: default avatarAndrew Pinski <quic_apinski@quicinc.com>
parent 5eadc673
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