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

move the (a-b) CMP 0 ? (a-b) : (b-a) optimization from fold_cond_expr_with_comparison to match

This patch moves the `(a-b) CMP 0 ? (a-b) : (b-a)` optimization
from fold_cond_expr_with_comparison to match.

Bootstrapped and tested on x86_64-linux-gnu.

Changes in:
v2: Removes `(a == b) ? 0 : (b - a)` handling since it was handled
    via r14-3606-g3d86e7f4a8ae
    Change zerop to integer_zerop for `(a - b) == 0 ? 0 : (b - a)`,
    Add `(a - b) != 0 ? (a - b) : 0` handling.

gcc/ChangeLog:

	* match.pd (`(A - B) CMP 0 ? (A - B) : (B - A)`):
	New patterns.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/phi-opt-38.c: New test.
parent 85e930ac
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