summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-09 19:21:59 +0000
committerrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-09 19:21:59 +0000
commit7333737f42f1f2b00a32fe2fbed73915b2a045d1 (patch)
tree9cf93feb394109316dfdca4d1a5926ddbe2320f6 /gcc
parent1b3841036e9cc0005835cc32e5983598e809ec24 (diff)
downloadgcc-7333737f42f1f2b00a32fe2fbed73915b2a045d1.tar.gz
PR target/30315
* config/i386/i386.h (CANONICALIZE_COMPARISON): Delete. * simplify-rtx.c (simplify_relational_operation_1): Add the canonicalization from i386.h. * doc/md.texi (Canonicalization of Instructions): Document it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/i386.h10
-rw-r--r--gcc/doc/md.texi7
-rw-r--r--gcc/simplify-rtx.c6
4 files changed, 20 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d748be2aa93..4c58b2865f5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-09 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
+ PR target/30315
+ * config/i386/i386.h (CANONICALIZE_COMPARISON): Delete.
+ * simplify-rtx.c (simplify_relational_operation_1): Add the
+ canonicalization from i386.h.
+ * doc/md.texi (Canonicalization of Instructions): Document it.
+
2007-09-09 Jan Hubicka <jh@suse.cz>
Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 06e90f4b600..4f8a531ed6f 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2070,16 +2070,6 @@ do { \
#define SELECT_CC_MODE(OP, X, Y) ix86_cc_mode ((OP), (X), (Y))
-/* Canonicalize overflow checks to save on the insn patterns. We change
- "a + b < b" into "a + b < a" and "a + b >= b" into "a + b >= a". */
-#define CANONICALIZE_COMPARISON(code, op0, op1) \
-{ \
- if ((code == LTU || code == GEU) \
- && GET_CODE (op0) == PLUS \
- && rtx_equal_p (op1, XEXP (op0, 1))) \
- op1 = XEXP (op0, 0); \
-}
-
/* Return nonzero if MODE implies a floating point inequality can be
reversed. */
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 1b0d766f736..c75b9838af1 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1,5 +1,5 @@
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001,
-@c 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+@c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -5514,6 +5514,11 @@ An operand of @code{neg}, @code{not}, @code{mult}, @code{plus}, or
above.
@item
+@code{(ltu (plus @var{a} @var{b}) @var{b})} is converted to
+@code{(ltu (plus @var{a} @var{b}) @var{a})}. Likewise with @code{geu} instead
+of @code{ltu}.
+
+@item
@code{(minus @var{x} (const_int @var{n}))} is converted to
@code{(plus @var{x} (const_int @var{-n}))}.
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index ac91f2fc92a..02f9e2b4c36 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3813,6 +3813,12 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
}
}
+ /* Canonicalize (LTU/GEU (PLUS a b) b) as (LTU/GEU (PLUS a b) a). */
+ if ((code == LTU || code == GEU)
+ && GET_CODE (op0) == PLUS
+ && rtx_equal_p (op1, XEXP (op0, 1)))
+ return simplify_gen_relational (code, mode, cmp_mode, op0, XEXP (op0, 0));
+
if (op1 == const0_rtx)
{
/* Canonicalize (GTU x 0) as (NE x 0). */