summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-31 15:19:33 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-31 15:19:33 +0000
commitd2cb78ca7b60bd3c3e4b7febdae2ee3f0c9ea70d (patch)
tree20349adba55f7efe9d61f97de733c2a776a6cf74 /gcc/simplify-rtx.c
parent7f7a6f4a129b77b67da8db39c088223443fd8d23 (diff)
downloadgcc-d2cb78ca7b60bd3c3e4b7febdae2ee3f0c9ea70d.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145353 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 6fe480f5dc7..b8b6ad81763 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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