From 7a3b13d103dded207b67281ead59e3cf8fe01aaa Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 9 Mar 1994 15:31:49 -0500 Subject: [PATCH] (rtx_equal_for_tmemref_p): Commutative operations are identical if the operands match in the opposite order. From-SVN: r6732 --- gcc/sched.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/sched.c b/gcc/sched.c index 26b3d30..56ad42c 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. */ -- 2.7.4