diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-08-17 18:03:37 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-08-17 18:03:37 -0400 |
commit | e650cbda8f5c83228925a222d2690c606755df29 (patch) | |
tree | 1e0cbb9d0a02989de66b4123e0b07b2b868cf9d3 | |
parent | 9fb8a9748b5081d5943483160030931394e5ef54 (diff) | |
download | gcc-e650cbda8f5c83228925a222d2690c606755df29.zip gcc-e650cbda8f5c83228925a222d2690c606755df29.tar.gz gcc-e650cbda8f5c83228925a222d2690c606755df29.tar.bz2 |
(fold_rtx): When folding tablejump, allow LABEL_REF to be in arg0;
also allow other arg to be MINUS, not just be equivalent to it.
From-SVN: r7939
-rw-r--r-- | gcc/cse.c | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -5369,20 +5369,43 @@ fold_rtx (x, insn) ADDR_DIFF_VEC table. */ if (const_arg1 && GET_CODE (const_arg1) == LABEL_REF) { - rtx y = lookup_as_function (folded_arg0, MINUS); + rtx y + = GET_CODE (folded_arg0) == MINUS ? folded_arg0 + : lookup_as_function (folded_arg0, MINUS); if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF && XEXP (XEXP (y, 1), 0) == XEXP (const_arg1, 0)) return XEXP (y, 0); /* Now try for a CONST of a MINUS like the above. */ - if ((y = lookup_as_function (folded_arg0, CONST)) != 0 + if ((y = (GET_CODE (folded_arg0) == CONST ? folded_arg0 + : lookup_as_function (folded_arg0, CONST))) != 0 && GET_CODE (XEXP (y, 0)) == MINUS && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF && XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg1, 0)) return XEXP (XEXP (y, 0), 0); } + /* Likewise if the operands are in the other order. */ + if (const_arg0 && GET_CODE (const_arg0) == LABEL_REF) + { + rtx y + = GET_CODE (folded_arg1) == MINUS ? folded_arg1 + : lookup_as_function (folded_arg1, MINUS); + + if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF + && XEXP (XEXP (y, 1), 0) == XEXP (const_arg0, 0)) + return XEXP (y, 0); + + /* Now try for a CONST of a MINUS like the above. */ + if ((y = (GET_CODE (folded_arg1) == CONST ? folded_arg1 + : lookup_as_function (folded_arg1, CONST))) != 0 + && GET_CODE (XEXP (y, 0)) == MINUS + && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF + && XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg0, 0)) + return XEXP (XEXP (y, 0), 0); + } + /* If second operand is a register equivalent to a negative CONST_INT, see if we can find a register equivalent to the positive constant. Make a MINUS if so. Don't do this for |