aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-03-09 15:31:06 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-03-09 15:31:06 -0500
commit413c72c2897f295e25c0bb95ba5998f5d6d29b57 (patch)
tree57b0e1ea02c17cba308181858b4e2549be6374e9 /gcc
parent1a7c818bd6043c4e86bbfc4c0befb3783dfd203d (diff)
downloadgcc-413c72c2897f295e25c0bb95ba5998f5d6d29b57.zip
gcc-413c72c2897f295e25c0bb95ba5998f5d6d29b57.tar.gz
gcc-413c72c2897f295e25c0bb95ba5998f5d6d29b57.tar.bz2
(rtx_equal_for_thread_p): Commutative operations are identical if the
operands match in the opposite order. From-SVN: r6731
Diffstat (limited to 'gcc')
-rw-r--r--gcc/jump.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index f2d4a44..1129b6d 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -4207,6 +4207,19 @@ rtx_equal_for_thread_p (x, y, yinsn)
if (GET_MODE (x) != GET_MODE (y))
return 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_thread_p (XEXP (x, 0), XEXP (y, 0))
+ && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 1)))
+ || (rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 1))
+ && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 0))));
+ else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2')
+ return (rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0))
+ && rtx_equal_for_thread_p (XEXP (x, 1), XEXP (y, 1)));
+ else if (GET_RTX_CLASS (code) == '1')
+ return rtx_equal_for_thread_p (XEXP (x, 0), XEXP (y, 0));
+
/* Handle special-cases first. */
switch (code)
{