rtx orig_src = SET_SRC (*orig_set);
machine_mode orig_mode = GET_MODE (SET_DEST (*orig_set));
rtx new_set;
- rtx cand_pat = PATTERN (cand->insn);
+ rtx cand_pat = single_set (cand->insn);
/* If the extension's source/destination registers are not the same
then we need to change the original load to reference the destination
/* If the destination operand of the extension is a different
register than the source operand, then additional restrictions
are needed. Note we have to handle cases where we have nested
- extensions in the source operand. */
+ extensions in the source operand.
+
+ Candidate insns are known to be single_sets, via the test in
+ find_removable_extensions. So we continue to use single_set here
+ rather than get_sub_rtx. */
+ rtx set = single_set (cand->insn);
bool copy_needed
- = (REGNO (SET_DEST (PATTERN (cand->insn)))
- != REGNO (get_extended_src_reg (SET_SRC (PATTERN (cand->insn)))));
+ = (REGNO (SET_DEST (set)) != REGNO (get_extended_src_reg (SET_SRC (set))));
if (copy_needed)
{
/* Considering transformation of
if (state->modified[INSN_UID (cand->insn)].kind != EXT_MODIFIED_NONE)
return false;
- machine_mode dst_mode = GET_MODE (SET_DEST (PATTERN (cand->insn)));
- rtx src_reg = get_extended_src_reg (SET_SRC (PATTERN (cand->insn)));
+ machine_mode dst_mode = GET_MODE (SET_DEST (set));
+ rtx src_reg = get_extended_src_reg (SET_SRC (set));
/* Ensure we can use the src_reg in dst_mode (needed for
the (set (reg1) (reg2)) insn mentioned above). */
|| !REG_P (SET_DEST (*dest_sub_rtx)))
return false;
- rtx tmp_reg = gen_rtx_REG (GET_MODE (SET_DEST (PATTERN (cand->insn))),
+ rtx tmp_reg = gen_rtx_REG (GET_MODE (SET_DEST (set)),
REGNO (SET_DEST (*dest_sub_rtx)));
- if (reg_overlap_mentioned_p (tmp_reg, SET_DEST (PATTERN (cand->insn))))
+ if (reg_overlap_mentioned_p (tmp_reg, SET_DEST (set)))
return false;
/* On RISC machines we must make sure that changing the mode of SRC_REG
/* The destination register of the extension insn must not be
used or set between the def_insn and cand->insn exclusive. */
- if (reg_used_between_p (SET_DEST (PATTERN (cand->insn)),
- def_insn, cand->insn)
- || reg_set_between_p (SET_DEST (PATTERN (cand->insn)),
- def_insn, cand->insn))
+ if (reg_used_between_p (SET_DEST (set), def_insn, cand->insn)
+ || reg_set_between_p (SET_DEST (set), def_insn, cand->insn))
return false;
/* We must be able to copy between the two registers. Generate,
is different than in the code to emit the copy as we have not
modified the defining insn yet. */
start_sequence ();
- rtx pat = PATTERN (cand->insn);
- rtx new_dst = gen_rtx_REG (GET_MODE (SET_DEST (pat)),
- REGNO (get_extended_src_reg (SET_SRC (pat))));
- rtx new_src = gen_rtx_REG (GET_MODE (SET_DEST (pat)),
- REGNO (SET_DEST (pat)));
+ rtx new_dst = gen_rtx_REG (GET_MODE (SET_DEST (set)),
+ REGNO (get_extended_src_reg (SET_SRC (set))));
+ rtx new_src = gen_rtx_REG (GET_MODE (SET_DEST (set)),
+ REGNO (SET_DEST (set)));
emit_move_insn (new_dst, new_src);
rtx_insn *insn = get_insns ();
return false;
while (REG_P (SET_SRC (*dest_sub_rtx))
- && (REGNO (SET_SRC (*dest_sub_rtx)) == REGNO (SET_DEST (pat))))
+ && (REGNO (SET_SRC (*dest_sub_rtx)) == REGNO (SET_DEST (set))))
{
/* Considering transformation of
(set (reg2) (expression))
implicitly sets it in word mode. */
if (WORD_REGISTER_OPERATIONS && known_lt (prec, BITS_PER_WORD))
{
- struct df_link *uses = get_uses (def_insn2, SET_DEST (pat));
+ struct df_link *uses = get_uses (def_insn2, SET_DEST (set));
if (!uses)
break;
used or set between the def_insn2 and def_insn exclusive.
Likewise for the other reg, i.e. check both reg1 and reg2
in the above comment. */
- if (reg_used_between_p (SET_DEST (PATTERN (cand->insn)),
- def_insn2, def_insn)
- || reg_set_between_p (SET_DEST (PATTERN (cand->insn)),
- def_insn2, def_insn)
+ if (reg_used_between_p (SET_DEST (set), def_insn2, def_insn)
+ || reg_set_between_p (SET_DEST (set), def_insn2, def_insn)
|| reg_used_between_p (src_reg, def_insn2, def_insn)
|| reg_set_between_p (src_reg, def_insn2, def_insn))
break;
if (state->modified[INSN_UID (cand->insn)].kind != EXT_MODIFIED_NONE)
{
machine_mode mode;
- rtx set;
if (state->modified[INSN_UID (cand->insn)].kind
!= (cand->code == ZERO_EXTEND
? EXT_MODIFIED_ZEXT : EXT_MODIFIED_SEXT)
|| state->modified[INSN_UID (cand->insn)].mode != cand->mode
- || (set = single_set (cand->insn)) == NULL_RTX)
+ || (set == NULL_RTX))
return false;
mode = GET_MODE (SET_DEST (set));
gcc_assert (GET_MODE_UNIT_SIZE (mode)
we do not allow the optimization of extensions where
the source and destination registers do not match. Thus
checking REG_P here is correct. */
- if (REG_P (XEXP (SET_SRC (PATTERN (curr_cand->insn)), 0))
- && (REGNO (SET_DEST (PATTERN (curr_cand->insn)))
- != REGNO (XEXP (SET_SRC (PATTERN (curr_cand->insn)), 0))))
+ rtx set = single_set (curr_cand->insn);
+ if (REG_P (XEXP (SET_SRC (set), 0))
+ && (REGNO (SET_DEST (set)) != REGNO (XEXP (SET_SRC (set), 0))))
{
reinsn_copy_list.safe_push (curr_cand->insn);
reinsn_copy_list.safe_push (state.defs_list[0]);
defining insn was used to eliminate a second extension
that was wider than the first. */
rtx sub_rtx = *get_sub_rtx (def_insn);
- rtx pat = PATTERN (curr_insn);
+ rtx set = single_set (curr_insn);
rtx new_dst = gen_rtx_REG (GET_MODE (SET_DEST (sub_rtx)),
- REGNO (XEXP (SET_SRC (pat), 0)));
+ REGNO (XEXP (SET_SRC (set), 0)));
rtx new_src = gen_rtx_REG (GET_MODE (SET_DEST (sub_rtx)),
- REGNO (SET_DEST (pat)));
- rtx set = gen_rtx_SET (new_dst, new_src);
- emit_insn_after (set, def_insn);
+ REGNO (SET_DEST (set)));
+ rtx new_set = gen_rtx_SET (new_dst, new_src);
+ emit_insn_after (new_set, def_insn);
}
/* Delete all useless extensions here in one sweep. */