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
This commit is contained in:
Bernd Schmidt 2009-03-31 15:19:33 +00:00 committed by Bernd Schmidt
parent 1569e19062
commit 1d1eb80cf6
2 changed files with 18 additions and 0 deletions

View File

@ -15,6 +15,10 @@
and keep using them to simplify new expressions, while applying the
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>
PR target/27237

View File

@ -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). */
if ((code == LTU || code == GEU)
&& GET_CODE (op0) == PLUS