Commit 1d1eb80c by Bernd Schmidt Committed by Bernd Schmidt

simplify-rtx.c (simplify_relational_operation_1): Simplify (LTU (PLUS a C) C) or…

simplify-rtx.c (simplify_relational_operation_1): Simplify (LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C)...

	* simplify-rtx.c (simplify_relational_operation_1): Simplify
	(LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C); likewise with
	GEU/LTU reversed.

From-SVN: r145353
parent 1569e190
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
and keep using them to simplify new expressions, while applying the and keep using them to simplify new expressions, while applying the
same substitutions to them as to the expression. same substitutions to them as to the expression.
* simplify-rtx.c (simplify_relational_operation_1): Simplify
(LTU (PLUS a C) C) or (LTU (PLUS a C) a) to (GEU a -C); likewise with
GEU/LTU reversed.
2009-03-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2009-03-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/27237 PR target/27237
......
...@@ -3856,6 +3856,20 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode, ...@@ -3856,6 +3856,20 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
} }
} }
/* (LTU/GEU (PLUS a C) C), where C is constant, can be simplified to
(GEU/LTU a -C). Likewise for (LTU/GEU (PLUS a C) a). */
if ((code == LTU || code == GEU)
&& GET_CODE (op0) == PLUS
&& GET_CODE (XEXP (op0, 1)) == CONST_INT
&& (rtx_equal_p (op1, XEXP (op0, 0))
|| rtx_equal_p (op1, XEXP (op0, 1))))
{
rtx new_cmp
= simplify_gen_unary (NEG, cmp_mode, XEXP (op0, 1), cmp_mode);
return simplify_gen_relational ((code == LTU ? GEU : LTU), mode,
cmp_mode, XEXP (op0, 0), new_cmp);
}
/* Canonicalize (LTU/GEU (PLUS a b) b) as (LTU/GEU (PLUS a b) a). */ /* Canonicalize (LTU/GEU (PLUS a b) b) as (LTU/GEU (PLUS a b) a). */
if ((code == LTU || code == GEU) if ((code == LTU || code == GEU)
&& GET_CODE (op0) == PLUS && GET_CODE (op0) == PLUS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment