summaryrefslogtreecommitdiff
path: root/gcc/sched.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-09 20:31:49 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-09 20:31:49 +0000
commitfa1cc5b4c8ebb83bf1482ec3a8c740c5098cb6d6 (patch)
treed26c5d84cd26976f5fd6cdda3bd526c8cc78c831 /gcc/sched.c
parenta8cc57a834bf50d9dba130cd3924f5923caa613a (diff)
downloadgcc-fa1cc5b4c8ebb83bf1482ec3a8c740c5098cb6d6.tar.gz
(rtx_equal_for_tmemref_p): Commutative operations are identical if the
operands match in the opposite order. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6732 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched.c')
-rw-r--r--gcc/sched.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/sched.c b/gcc/sched.c
index 26b3d30ae67..56ad42ce1d0 100644
--- a/gcc/sched.c
+++ b/gcc/sched.c
@@ -1,5 +1,5 @@
/* Instruction scheduling pass.
- Copyright (C) 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
Enhanced by, and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@ -481,6 +481,19 @@ rtx_equal_for_memref_p (x, y)
if (code == SYMBOL_REF)
return XSTR (x, 0) == XSTR (y, 0);
+ /* For commutative operations, the RTX match if the operand match in any
+ order. Also handle the simple binary and unary cases without a loop. */
+ if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
+ return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))
+ && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1)))
+ || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1))
+ && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0))));
+ else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2')
+ return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))
+ && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1)));
+ else if (GET_RTX_CLASS (code) == '1')
+ return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0));
+
/* Compare the elements. If any pair of corresponding elements
fail to match, return 0 for the whole things. */