aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2009-03-31 15:19:33 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2009-03-31 15:19:33 +0000
commit1d1eb80cf6d7d4ef999bc3a3024fd49aab88f92b (patch)
tree20349adba55f7efe9d61f97de733c2a776a6cf74 /gcc
parent1569e19062140aa281bc0d08d1be4cf8d4a0e7bf (diff)
downloadgcc-1d1eb80cf6d7d4ef999bc3a3024fd49aab88f92b.zip
gcc-1d1eb80cf6d7d4ef999bc3a3024fd49aab88f92b.tar.gz
gcc-1d1eb80cf6d7d4ef999bc3a3024fd49aab88f92b.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/simplify-rtx.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d4686fd..9aeafa9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 6fe480f..b8b6ad8 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