Commit 67a37737 by Richard Kenner

(fold_rtx, case MEM): Surround TRUNCATE for jump table entry with a CONST.

(fold_rtx, case '1'): Handle operand 0 of a CONST.
(fold_rtx, case PLUS): Handle (const (minus (label_ref) (label_ref))).

From-SVN: r7832
parent 96c9d70d
...@@ -5001,7 +5001,11 @@ fold_rtx (x, insn) ...@@ -5001,7 +5001,11 @@ fold_rtx (x, insn)
if (GET_MODE (table) != Pmode) if (GET_MODE (table) != Pmode)
new = gen_rtx (TRUNCATE, GET_MODE (table), new); new = gen_rtx (TRUNCATE, GET_MODE (table), new);
return new; /* Indicate this is a constant. This isn't a
valid form of CONST, but it will only be used
to fold the next insns and then discarded, so
it should be safe. */
return gen_rtx (CONST, GET_MODE (new), new);
} }
} }
} }
...@@ -5174,13 +5178,26 @@ fold_rtx (x, insn) ...@@ -5174,13 +5178,26 @@ fold_rtx (x, insn)
switch (GET_RTX_CLASS (code)) switch (GET_RTX_CLASS (code))
{ {
case '1': case '1':
/* We can't simplify extension ops unless we know the original mode. */ {
if ((code == ZERO_EXTEND || code == SIGN_EXTEND) int is_const = 0;
&& mode_arg0 == VOIDmode)
break; /* We can't simplify extension ops unless we know the
new = simplify_unary_operation (code, mode, original mode. */
const_arg0 ? const_arg0 : folded_arg0, if ((code == ZERO_EXTEND || code == SIGN_EXTEND)
mode_arg0); && mode_arg0 == VOIDmode)
break;
/* If we had a CONST, strip it off and put it back later if we
fold. */
if (const_arg0 != 0 && GET_CODE (const_arg0) == CONST)
is_const = 1, const_arg0 = XEXP (const_arg0, 0);
new = simplify_unary_operation (code, mode,
const_arg0 ? const_arg0 : folded_arg0,
mode_arg0);
if (new != 0 && is_const)
new = gen_rtx (CONST, mode, new);
}
break; break;
case '<': case '<':
...@@ -5358,6 +5375,13 @@ fold_rtx (x, insn) ...@@ -5358,6 +5375,13 @@ fold_rtx (x, insn)
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. */
if ((y = 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);
} }
/* If second operand is a register equivalent to a negative /* If second operand is a register equivalent to a negative
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment