aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2002-05-03 22:56:42 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2002-05-03 20:56:42 +0000
commit37ad04a5a4a1d3b7e1f289f2e0bd284146d1f15f (patch)
tree55a55fef5e5bfeb45e3eb55dfa2416cea24ebfba
parentb548220837d0386f470b48d1318b7c005d38aa3c (diff)
downloadgcc-37ad04a5a4a1d3b7e1f289f2e0bd284146d1f15f.zip
gcc-37ad04a5a4a1d3b7e1f289f2e0bd284146d1f15f.tar.gz
gcc-37ad04a5a4a1d3b7e1f289f2e0bd284146d1f15f.tar.bz2
i386.c (expand_movstr, [...]): Fix inline-all-stringops sequence.
* i386.c (expand_movstr, expand_clrstr): Fix inline-all-stringops sequence. From-SVN: r53128
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/i386/i386.c42
2 files changed, 31 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6e53aa4..fc2ad3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR opt/6534
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 00d7d0d..b9ca483 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9244,6 +9244,9 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
{
rtx countreg2;
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
library version, since it is usually equally fast and result in
@@ -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
add some customizability to this code. */
- if (count == 0
- && align < (TARGET_PENTIUMPRO && (count == 0
- || count >= (unsigned int) 260)
- ? 8 : UNITS_PER_WORD))
+ if (count == 0 && align < desired_alignment)
{
label = gen_label_rtx ();
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)
emit_label (label);
LABEL_NUSES (label) = 1;
}
- if (align <= 4
- && ((TARGET_PENTIUMPRO && (count == 0
- || count >= (unsigned int) 260))
- || TARGET_64BIT))
+ if (align <= 4 && desired_alignment > 4)
{
rtx label = ix86_expand_aligntest (destreg, 4);
emit_insn (gen_strmovsi (destreg, srcreg));
@@ -9310,6 +9307,12 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
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)
emit_insn (gen_cld ());
if (TARGET_64BIT)
@@ -9455,6 +9458,10 @@ ix86_expand_clrstr (src, count_exp, align_exp)
{
rtx countreg2;
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
library version, since it is usually equally fast and result in
@@ -9469,13 +9476,10 @@ ix86_expand_clrstr (src, count_exp, align_exp)
countreg = copy_to_mode_reg (counter_mode, count_exp);
zeroreg = copy_to_mode_reg (Pmode, const0_rtx);
- if (count == 0
- && align < (TARGET_PENTIUMPRO && (count == 0
- || count >= (unsigned int) 260)
- ? 8 : UNITS_PER_WORD))
+ if (count == 0 && align < desired_alignment)
{
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);
}
if (align <= 1)
@@ -9496,8 +9500,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
emit_label (label);
LABEL_NUSES (label) = 1;
}
- if (align <= 4 && TARGET_PENTIUMPRO && (count == 0
- || count >= (unsigned int) 260))
+ if (align <= 4 && desired_alignment > 4)
{
rtx label = ix86_expand_aligntest (destreg, 4);
emit_insn (gen_strsetsi (destreg, (TARGET_64BIT
@@ -9508,6 +9511,13 @@ ix86_expand_clrstr (src, count_exp, align_exp)
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)
emit_insn (gen_cld ());
if (TARGET_64BIT)
@@ -9523,12 +9533,12 @@ ix86_expand_clrstr (src, count_exp, align_exp)
emit_insn (gen_rep_stossi (destreg, countreg2, zeroreg,
destreg, countreg2));
}
-
if (label)
{
emit_label (label);
LABEL_NUSES (label) = 1;
}
+
if (TARGET_64BIT && align > 4 && count != 0 && (count & 4))
emit_insn (gen_strsetsi (destreg,
gen_rtx_SUBREG (SImode, zeroreg, 0)));