Commit 37ad04a5 by Jan Hubicka Committed by Jan Hubicka

i386.c (expand_movstr, [...]): Fix inline-all-stringops sequence.

	* i386.c  (expand_movstr, expand_clrstr): Fix inline-all-stringops
	sequence.

From-SVN: r53128
parent b5482208
Fri May 3 22:53:37 CEST 2002 Jan Hubicka <jh@suse.cz>
* i386.c (expand_movstr, expand_clrstr): Fix inline-all-stringops
sequence.
2002-05-03 Richard Henderson <rth@redhat.com> 2002-05-03 Richard Henderson <rth@redhat.com>
PR opt/6534 PR opt/6534
......
...@@ -9244,6 +9244,9 @@ ix86_expand_movstr (dst, src, count_exp, align_exp) ...@@ -9244,6 +9244,9 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
{ {
rtx countreg2; rtx countreg2;
rtx label = NULL; rtx label = NULL;
int desired_alignment = (TARGET_PENTIUMPRO
&& (count == 0 || count >= (unsigned int) 260)
? 8 : UNITS_PER_WORD);
/* In case we don't know anything about the alignment, default to /* In case we don't know anything about the alignment, default to
library version, since it is usually equally fast and result in library version, since it is usually equally fast and result in
...@@ -9273,10 +9276,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp) ...@@ -9273,10 +9276,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
This is quite costy. Maybe we can revisit this decision later or This is quite costy. Maybe we can revisit this decision later or
add some customizability to this code. */ add some customizability to this code. */
if (count == 0 if (count == 0 && align < desired_alignment)
&& align < (TARGET_PENTIUMPRO && (count == 0
|| count >= (unsigned int) 260)
? 8 : UNITS_PER_WORD))
{ {
label = gen_label_rtx (); label = gen_label_rtx ();
emit_cmp_and_jump_insns (countreg, GEN_INT (UNITS_PER_WORD - 1), emit_cmp_and_jump_insns (countreg, GEN_INT (UNITS_PER_WORD - 1),
...@@ -9298,10 +9298,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp) ...@@ -9298,10 +9298,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
emit_label (label); emit_label (label);
LABEL_NUSES (label) = 1; LABEL_NUSES (label) = 1;
} }
if (align <= 4 if (align <= 4 && desired_alignment > 4)
&& ((TARGET_PENTIUMPRO && (count == 0
|| count >= (unsigned int) 260))
|| TARGET_64BIT))
{ {
rtx label = ix86_expand_aligntest (destreg, 4); rtx label = ix86_expand_aligntest (destreg, 4);
emit_insn (gen_strmovsi (destreg, srcreg)); emit_insn (gen_strmovsi (destreg, srcreg));
...@@ -9310,6 +9307,12 @@ ix86_expand_movstr (dst, src, count_exp, align_exp) ...@@ -9310,6 +9307,12 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
LABEL_NUSES (label) = 1; LABEL_NUSES (label) = 1;
} }
if (label && desired_alignment > 4 && !TARGET_64BIT)
{
emit_label (label);
LABEL_NUSES (label) = 1;
label = NULL_RTX;
}
if (!TARGET_SINGLE_STRINGOP) if (!TARGET_SINGLE_STRINGOP)
emit_insn (gen_cld ()); emit_insn (gen_cld ());
if (TARGET_64BIT) if (TARGET_64BIT)
...@@ -9455,6 +9458,10 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9455,6 +9458,10 @@ ix86_expand_clrstr (src, count_exp, align_exp)
{ {
rtx countreg2; rtx countreg2;
rtx label = NULL; rtx label = NULL;
/* Compute desired alignment of the string operation. */
int desired_alignment = (TARGET_PENTIUMPRO
&& (count == 0 || count >= (unsigned int) 260)
? 8 : UNITS_PER_WORD);
/* In case we don't know anything about the alignment, default to /* In case we don't know anything about the alignment, default to
library version, since it is usually equally fast and result in library version, since it is usually equally fast and result in
...@@ -9469,13 +9476,10 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9469,13 +9476,10 @@ ix86_expand_clrstr (src, count_exp, align_exp)
countreg = copy_to_mode_reg (counter_mode, count_exp); countreg = copy_to_mode_reg (counter_mode, count_exp);
zeroreg = copy_to_mode_reg (Pmode, const0_rtx); zeroreg = copy_to_mode_reg (Pmode, const0_rtx);
if (count == 0 if (count == 0 && align < desired_alignment)
&& align < (TARGET_PENTIUMPRO && (count == 0
|| count >= (unsigned int) 260)
? 8 : UNITS_PER_WORD))
{ {
label = gen_label_rtx (); label = gen_label_rtx ();
emit_cmp_and_jump_insns (countreg, GEN_INT (UNITS_PER_WORD - 1), emit_cmp_and_jump_insns (countreg, GEN_INT (desired_alignment - 1),
LEU, 0, counter_mode, 1, label); LEU, 0, counter_mode, 1, label);
} }
if (align <= 1) if (align <= 1)
...@@ -9496,8 +9500,7 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9496,8 +9500,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
emit_label (label); emit_label (label);
LABEL_NUSES (label) = 1; LABEL_NUSES (label) = 1;
} }
if (align <= 4 && TARGET_PENTIUMPRO && (count == 0 if (align <= 4 && desired_alignment > 4)
|| count >= (unsigned int) 260))
{ {
rtx label = ix86_expand_aligntest (destreg, 4); rtx label = ix86_expand_aligntest (destreg, 4);
emit_insn (gen_strsetsi (destreg, (TARGET_64BIT emit_insn (gen_strsetsi (destreg, (TARGET_64BIT
...@@ -9508,6 +9511,13 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9508,6 +9511,13 @@ ix86_expand_clrstr (src, count_exp, align_exp)
LABEL_NUSES (label) = 1; LABEL_NUSES (label) = 1;
} }
if (label && desired_alignment > 4 && !TARGET_64BIT)
{
emit_label (label);
LABEL_NUSES (label) = 1;
label = NULL_RTX;
}
if (!TARGET_SINGLE_STRINGOP) if (!TARGET_SINGLE_STRINGOP)
emit_insn (gen_cld ()); emit_insn (gen_cld ());
if (TARGET_64BIT) if (TARGET_64BIT)
...@@ -9523,12 +9533,12 @@ ix86_expand_clrstr (src, count_exp, align_exp) ...@@ -9523,12 +9533,12 @@ ix86_expand_clrstr (src, count_exp, align_exp)
emit_insn (gen_rep_stossi (destreg, countreg2, zeroreg, emit_insn (gen_rep_stossi (destreg, countreg2, zeroreg,
destreg, countreg2)); destreg, countreg2));
} }
if (label) if (label)
{ {
emit_label (label); emit_label (label);
LABEL_NUSES (label) = 1; LABEL_NUSES (label) = 1;
} }
if (TARGET_64BIT && align > 4 && count != 0 && (count & 4)) if (TARGET_64BIT && align > 4 && count != 0 && (count & 4))
emit_insn (gen_strsetsi (destreg, emit_insn (gen_strsetsi (destreg,
gen_rtx_SUBREG (SImode, zeroreg, 0))); gen_rtx_SUBREG (SImode, zeroreg, 0)));
......
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