(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
This commit is contained in:
parent
9fb8a9748b
commit
e650cbda8f
27
gcc/cse.c
27
gcc/cse.c
@ -5369,20 +5369,43 @@ fold_rtx (x, insn)
|
|||||||
ADDR_DIFF_VEC table. */
|
ADDR_DIFF_VEC table. */
|
||||||
if (const_arg1 && GET_CODE (const_arg1) == LABEL_REF)
|
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
|
if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
|
||||||
&& XEXP (XEXP (y, 1), 0) == XEXP (const_arg1, 0))
|
&& XEXP (XEXP (y, 1), 0) == XEXP (const_arg1, 0))
|
||||||
return XEXP (y, 0);
|
return XEXP (y, 0);
|
||||||
|
|
||||||
/* Now try for a CONST of a MINUS like the above. */
|
/* 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 (y, 0)) == MINUS
|
||||||
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
|
&& GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
|
||||||
&& XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg1, 0))
|
&& XEXP (XEXP (XEXP (y, 0),1), 0) == XEXP (const_arg1, 0))
|
||||||
return XEXP (XEXP (y, 0), 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
|
/* If second operand is a register equivalent to a negative
|
||||||
CONST_INT, see if we can find a register equivalent to the
|
CONST_INT, see if we can find a register equivalent to the
|
||||||
positive constant. Make a MINUS if so. Don't do this for
|
positive constant. Make a MINUS if so. Don't do this for
|
||||||
|
Loading…
Reference in New Issue
Block a user