dse.c (find_shift_sequence): No-op rework of control flow.

gcc/
	* dse.c (find_shift_sequence): No-op rework of control flow.

From-SVN: r128614
This commit is contained in:
Richard Sandiford 2007-09-20 07:43:49 +00:00 committed by Richard Sandiford
parent 6d3b5aea0b
commit c6f3019a9a
2 changed files with 53 additions and 57 deletions

View File

@ -1,3 +1,7 @@
2007-09-20 Richard Sandiford <rsandifo@nildram.co.uk>
* dse.c (find_shift_sequence): No-op rework of control flow.
2007-09-19 Richard Sandiford <rsandifo@nildram.co.uk>
* config/mips/mips.c (build_mips16_call_stub): Tidy. Fix second

View File

@ -1399,6 +1399,7 @@ find_shift_sequence (rtx read_reg,
{
enum machine_mode store_mode = GET_MODE (store_info->mem);
enum machine_mode read_mode = GET_MODE (read_info->mem);
rtx chosen_seq = NULL;
/* Some machines like the x86 have shift insns for each size of
operand. Other machines like the ppc or the ia-64 may only have
@ -1409,8 +1410,9 @@ find_shift_sequence (rtx read_reg,
for (; access_size < UNITS_PER_WORD; access_size *= 2)
{
rtx target, new_reg;
rtx target, new_reg, shift_seq, insn;
enum machine_mode new_mode;
int cost;
/* Try a wider mode if truncating the store mode to ACCESS_SIZE
bytes requires a real instruction. */
@ -1431,18 +1433,13 @@ find_shift_sequence (rtx read_reg,
target = expand_binop (new_mode, lshr_optab, new_reg,
GEN_INT (shift), new_reg, 1, OPTAB_DIRECT);
if (target == new_reg)
{
rtx shift_seq = get_insns ();
shift_seq = get_insns ();
end_sequence ();
/* If cost is too great, set target to NULL and
let the iteration happen. */
if (shift_seq != NULL)
{
int cost = 0;
rtx insn;
if (target != new_reg || shift_seq == NULL)
continue;
cost = 0;
for (insn = shift_seq; insn != NULL_RTX; insn = NEXT_INSN (insn))
if (INSN_P (insn))
cost += insn_rtx_cost (PATTERN (insn));
@ -1455,8 +1452,9 @@ find_shift_sequence (rtx read_reg,
GET_MODE_CLASS (READ_MODE). But in practice the
answer will depend only on ACCESS_SIZE. */
if (cost <= COSTS_N_INSNS (1))
{
if (cost > COSTS_N_INSNS (1))
continue;
/* We found an acceptable shift. Generate a move to
take the value from the store and put it into the
shift pseudo, then shift it, then generate another
@ -1480,18 +1478,12 @@ find_shift_sequence (rtx read_reg,
}
/* Get the three insn sequence and return it. */
shift_seq = get_insns ();
end_sequence ();
return shift_seq;
}
}
}
else
/* End the sequence. */
chosen_seq = get_insns ();
end_sequence ();
break;
}
return NULL;
return chosen_seq;
}