This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix i386 memcpy/memset expanders
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Wed, 31 Dec 2003 20:19:27 +0100
- Subject: Fix i386 memcpy/memset expanders
Hi,
for some reasons we no longer expand memcpy into rep ; movsb at -Os and
we do expand into rep ; movsl even for very large blocks on targets
where it is not optimal. Fixed thus.
Bootstrapped/regtested i686-pc-gnu-linux.
2003-12-31 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_movstr, ix86_expand_clrstr): Use libcal
for large blocks only when not optimizing size or when REP_MOVL
is not optimal.
* i386.md (movstr expander): Enable when optimizing for size.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.626
diff -c -3 -p -r1.626 i386.c
*** config/i386/i386.c 27 Dec 2003 05:56:15 -0000 1.626
--- config/i386/i386.c 31 Dec 2003 10:12:56 -0000
*************** ix86_expand_movstr (rtx dst, rtx src, rt
*** 10920,10926 ****
if (GET_CODE (count_exp) == CONST_INT)
{
count = INTVAL (count_exp);
! if (!TARGET_INLINE_ALL_STRINGOPS && count > 64)
return 0;
}
--- 10920,10929 ----
if (GET_CODE (count_exp) == CONST_INT)
{
count = INTVAL (count_exp);
! if ((!TARGET_INLINE_ALL_STRINGOPS
! && !TARGET_REP_MOVL_OPTIMAL
! && !optimize_size)
! && count > 64)
return 0;
}
*************** ix86_expand_clrstr (rtx src, rtx count_e
*** 11157,11163 ****
if (GET_CODE (count_exp) == CONST_INT)
{
count = INTVAL (count_exp);
! if (!TARGET_INLINE_ALL_STRINGOPS && count > 64)
return 0;
}
/* Figure out proper mode for counter. For 32bits it is always SImode,
--- 11160,11169 ----
if (GET_CODE (count_exp) == CONST_INT)
{
count = INTVAL (count_exp);
! if ((!TARGET_INLINE_ALL_STRINGOPS
! && !TARGET_REP_MOVL_OPTIMAL
! && !optimize_size)
! && count > 64)
return 0;
}
/* Figure out proper mode for counter. For 32bits it is always SImode,
Index: config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.495
diff -c -3 -p -r1.495 i386.md
*** config/i386/i386.md 30 Dec 2003 01:21:50 -0000 1.495
--- config/i386/i386.md 31 Dec 2003 10:12:58 -0000
***************
*** 15153,15159 ****
(use (match_operand:BLK 1 "memory_operand" ""))
(use (match_operand:SI 2 "nonmemory_operand" ""))
(use (match_operand:SI 3 "const_int_operand" ""))]
! "! optimize_size"
{
if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
DONE;
--- 15153,15159 ----
(use (match_operand:BLK 1 "memory_operand" ""))
(use (match_operand:SI 2 "nonmemory_operand" ""))
(use (match_operand:SI 3 "const_int_operand" ""))]
! ""
{
if (ix86_expand_movstr (operands[0], operands[1], operands[2], operands[3]))
DONE;