Commit 74411039 by Jan Hubicka Committed by Jan Hubicka

i386.c (ix86_output_addr_diff_elt): Avoid x86_64 binutils bug workaround.

	* i386.c (ix86_output_addr_diff_elt): Avoid x86_64 binutils bug
	workaround.
	(ix86_expand_int_movcc): Avoid x86_64 compilation chrash.
	(ix86_expand_clrstr): Fix typo.
	* loop.c (gen_load_of_final_value): New.
	(loop_givs_rescan, strength_reduce, check_dbra_loop):
	Use it.

From-SVN: r52664
parent 1a887f86
Tue Apr 23 14:24:25 CEST 2002 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_output_addr_diff_elt): Avoid x86_64 binutils bug
workaround.
(ix86_expand_int_movcc): Avoid x86_64 compilation chrash.
(ix86_expand_clrstr): Fix typo.
* loop.c (gen_load_of_final_value): New.
(loop_givs_rescan, strength_reduce, check_dbra_loop):
Use it.
2002-04-23 Roger Sayle <roger@eyesopen.com> 2002-04-23 Roger Sayle <roger@eyesopen.com>
* builtins.c (builtin_memset_gen_str): New function. * builtins.c (builtin_memset_gen_str): New function.
......
...@@ -6686,7 +6686,7 @@ ix86_output_addr_diff_elt (file, value, rel) ...@@ -6686,7 +6686,7 @@ ix86_output_addr_diff_elt (file, value, rel)
int value, rel; int value, rel;
{ {
if (TARGET_64BIT) if (TARGET_64BIT)
fprintf (file, "%s%s%d-.+(.-%s%d)\n", fprintf (file, "%s%s%d-%s%d\n",
ASM_LONG, LPREFIX, value, LPREFIX, rel); ASM_LONG, LPREFIX, value, LPREFIX, rel);
else if (HAVE_AS_GOTOFF_IN_DATA) else if (HAVE_AS_GOTOFF_IN_DATA)
fprintf (file, "%s%s%d@GOTOFF\n", ASM_LONG, LPREFIX, value); fprintf (file, "%s%s%d@GOTOFF\n", ASM_LONG, LPREFIX, value);
...@@ -7983,6 +7983,10 @@ ix86_expand_int_movcc (operands) ...@@ -7983,6 +7983,10 @@ ix86_expand_int_movcc (operands)
&& GET_CODE (ix86_compare_op1) == CONST_INT && GET_CODE (ix86_compare_op1) == CONST_INT
&& mode != HImode && mode != HImode
&& (unsigned int) INTVAL (ix86_compare_op1) != 0xffffffff && (unsigned int) INTVAL (ix86_compare_op1) != 0xffffffff
/* The operand still must be representable as sign extended value. */
&& (!TARGET_64BIT
|| GET_MODE (ix86_compare_op0) != DImode
|| (unsigned int) INTVAL (ix86_compare_op1) != 0x7fffffff)
&& GET_CODE (operands[2]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT) && GET_CODE (operands[3]) == CONST_INT)
{ {
...@@ -9528,7 +9532,7 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9528,7 +9532,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
gen_rtx_SUBREG (SImode, zeroreg, 0))); gen_rtx_SUBREG (SImode, zeroreg, 0)));
if (TARGET_64BIT && (align <= 4 || count == 0)) if (TARGET_64BIT && (align <= 4 || count == 0))
{ {
rtx label = ix86_expand_aligntest (destreg, 2); rtx label = ix86_expand_aligntest (countreg, 2);
emit_insn (gen_strsetsi (destreg, emit_insn (gen_strsetsi (destreg,
gen_rtx_SUBREG (SImode, zeroreg, 0))); gen_rtx_SUBREG (SImode, zeroreg, 0)));
emit_label (label); emit_label (label);
...@@ -9539,7 +9543,7 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9539,7 +9543,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
gen_rtx_SUBREG (HImode, zeroreg, 0))); gen_rtx_SUBREG (HImode, zeroreg, 0)));
if (align <= 2 || count == 0) if (align <= 2 || count == 0)
{ {
rtx label = ix86_expand_aligntest (destreg, 2); rtx label = ix86_expand_aligntest (countreg, 2);
emit_insn (gen_strsethi (destreg, emit_insn (gen_strsethi (destreg,
gen_rtx_SUBREG (HImode, zeroreg, 0))); gen_rtx_SUBREG (HImode, zeroreg, 0)));
emit_label (label); emit_label (label);
...@@ -9550,7 +9554,7 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9550,7 +9554,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
gen_rtx_SUBREG (QImode, zeroreg, 0))); gen_rtx_SUBREG (QImode, zeroreg, 0)));
if (align <= 1 || count == 0) if (align <= 1 || count == 0)
{ {
rtx label = ix86_expand_aligntest (destreg, 1); rtx label = ix86_expand_aligntest (countreg, 1);
emit_insn (gen_strsetqi (destreg, emit_insn (gen_strsetqi (destreg,
gen_rtx_SUBREG (QImode, zeroreg, 0))); gen_rtx_SUBREG (QImode, zeroreg, 0)));
emit_label (label); emit_label (label);
......
...@@ -354,6 +354,7 @@ static rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx)); ...@@ -354,6 +354,7 @@ static rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx));
static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int)); static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int));
static void loop_delete_insns PARAMS ((rtx, rtx)); static void loop_delete_insns PARAMS ((rtx, rtx));
static HOST_WIDE_INT remove_constant_addition PARAMS ((rtx *)); static HOST_WIDE_INT remove_constant_addition PARAMS ((rtx *));
static rtx gen_load_of_final_value PARAMS ((rtx, rtx));
void debug_ivs PARAMS ((const struct loop *)); void debug_ivs PARAMS ((const struct loop *));
void debug_iv_class PARAMS ((const struct iv_class *)); void debug_iv_class PARAMS ((const struct iv_class *));
void debug_biv PARAMS ((const struct induction *)); void debug_biv PARAMS ((const struct induction *));
...@@ -4798,7 +4799,8 @@ loop_givs_rescan (loop, bl, reg_map) ...@@ -4798,7 +4799,8 @@ loop_givs_rescan (loop, bl, reg_map)
v->mult_val, v->add_val, v->dest_reg); v->mult_val, v->add_val, v->dest_reg);
else if (v->final_value) else if (v->final_value)
loop_insn_sink_or_swim (loop, loop_insn_sink_or_swim (loop,
gen_move_insn (v->dest_reg, v->final_value)); gen_load_of_final_value (v->dest_reg,
v->final_value));
if (loop_dump_stream) if (loop_dump_stream)
{ {
...@@ -5155,8 +5157,9 @@ strength_reduce (loop, flags) ...@@ -5155,8 +5157,9 @@ strength_reduce (loop, flags)
value, so we don't need another one. We can't calculate the value, so we don't need another one. We can't calculate the
proper final value for such a biv here anyways. */ proper final value for such a biv here anyways. */
if (bl->final_value && ! bl->reversed) if (bl->final_value && ! bl->reversed)
loop_insn_sink_or_swim (loop, gen_move_insn loop_insn_sink_or_swim (loop,
(bl->biv->dest_reg, bl->final_value)); gen_load_of_final_value (bl->biv->dest_reg,
bl->final_value));
if (loop_dump_stream) if (loop_dump_stream)
fprintf (loop_dump_stream, "Reg %d: biv eliminated\n", fprintf (loop_dump_stream, "Reg %d: biv eliminated\n",
...@@ -5165,8 +5168,8 @@ strength_reduce (loop, flags) ...@@ -5165,8 +5168,8 @@ strength_reduce (loop, flags)
/* See above note wrt final_value. But since we couldn't eliminate /* See above note wrt final_value. But since we couldn't eliminate
the biv, we must set the value after the loop instead of before. */ the biv, we must set the value after the loop instead of before. */
else if (bl->final_value && ! bl->reversed) else if (bl->final_value && ! bl->reversed)
loop_insn_sink (loop, gen_move_insn (bl->biv->dest_reg, loop_insn_sink (loop, gen_load_of_final_value (bl->biv->dest_reg,
bl->final_value)); bl->final_value));
} }
/* Go through all the instructions in the loop, making all the /* Go through all the instructions in the loop, making all the
...@@ -8361,7 +8364,7 @@ check_dbra_loop (loop, insn_count) ...@@ -8361,7 +8364,7 @@ check_dbra_loop (loop, insn_count)
if ((REGNO_LAST_UID (bl->regno) != INSN_UID (first_compare)) if ((REGNO_LAST_UID (bl->regno) != INSN_UID (first_compare))
|| ! bl->init_insn || ! bl->init_insn
|| REGNO_FIRST_UID (bl->regno) != INSN_UID (bl->init_insn)) || REGNO_FIRST_UID (bl->regno) != INSN_UID (bl->init_insn))
loop_insn_sink (loop, gen_move_insn (reg, final_value)); loop_insn_sink (loop, gen_load_of_final_value (reg, final_value));
/* Delete compare/branch at end of loop. */ /* Delete compare/branch at end of loop. */
delete_related_insns (PREV_INSN (loop_end)); delete_related_insns (PREV_INSN (loop_end));
...@@ -10352,6 +10355,21 @@ loop_insn_sink (loop, pattern) ...@@ -10352,6 +10355,21 @@ loop_insn_sink (loop, pattern)
return loop_insn_emit_before (loop, 0, loop->sink, pattern); return loop_insn_emit_before (loop, 0, loop->sink, pattern);
} }
/* bl->final_value can be eighter general_operand or PLUS of general_operand
and constant. Emit sequence of intructions to load it into REG */
static rtx
gen_load_of_final_value (reg, final_value)
rtx reg, final_value;
{
rtx seq;
start_sequence ();
final_value = force_operand (final_value, reg);
if (final_value != reg)
emit_move_insn (reg, final_value);
seq = gen_sequence ();
end_sequence ();
return seq;
}
/* If the loop has multiple exits, emit insn for PATTERN before the /* If the loop has multiple exits, emit insn for PATTERN before the
loop to ensure that it will always be executed no matter how the loop to ensure that it will always be executed no matter how the
......
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