diff options
author | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 15:19:33 +0000 |
---|---|---|
committer | bernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-31 15:19:33 +0000 |
commit | d2cb78ca7b60bd3c3e4b7febdae2ee3f0c9ea70d (patch) | |
tree | 20349adba55f7efe9d61f97de733c2a776a6cf74 /gcc/simplify-rtx.c | |
parent | 7f7a6f4a129b77b67da8db39c088223443fd8d23 (diff) | |
download | gcc-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.c | 14 |
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 |