(expand_end_case): Make sure gen_casesi operands are

valid by passing them through copy_to_mode_reg if necessary.

From-SVN: r7192
This commit is contained in:
Jim Wilson 1994-05-02 15:21:14 -07:00
parent 09dcff637f
commit 086f237db0

View File

@ -4438,6 +4438,8 @@ expand_end_case (orig_index)
{ {
enum machine_mode index_mode = SImode; enum machine_mode index_mode = SImode;
int index_bits = GET_MODE_BITSIZE (index_mode); int index_bits = GET_MODE_BITSIZE (index_mode);
rtx op1, op2;
enum machine_mode op_mode;
/* Convert the index to SImode. */ /* Convert the index to SImode. */
if (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (index_expr))) if (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (index_expr)))
@ -4467,10 +4469,26 @@ expand_end_case (orig_index)
index = protect_from_queue (index, 0); index = protect_from_queue (index, 0);
do_pending_stack_adjust (); do_pending_stack_adjust ();
emit_jump_insn (gen_casesi (index, expand_expr (minval, NULL_RTX, op_mode = insn_operand_mode[(int)CODE_FOR_casesi][0];
VOIDmode, 0), if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][0])
expand_expr (range, NULL_RTX, (index, op_mode))
VOIDmode, 0), index = copy_to_mode_reg (op_mode, index);
op1 = expand_expr (minval, NULL_RTX, VOIDmode, 0);
op_mode = insn_operand_mode[(int)CODE_FOR_casesi][1];
if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][1])
(op1, op_mode))
op1 = copy_to_mode_reg (op_mode, op1);
op2 = expand_expr (range, NULL_RTX, VOIDmode, 0);
op_mode = insn_operand_mode[(int)CODE_FOR_casesi][2];
if (! (*insn_operand_predicate[(int)CODE_FOR_casesi][2])
(op2, op_mode))
op2 = copy_to_mode_reg (op_mode, op2);
emit_jump_insn (gen_casesi (index, op1, op2,
table_label, default_label)); table_label, default_label));
win = 1; win = 1;
} }