This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,i386] fix PR 11001
On Fri, Oct 12, 2007 at 09:12:47AM -0700, Nathan Froyd wrote:
> On Fri, Oct 05, 2007 at 07:59:04AM +0200, Uros Bizjak wrote:
> > Sorry for not being clear here. TARGET_INLINE_ALL_STRINGOPS* should be
> > respected, and libcalls should not be generated in this case. For
> > example, we use -minline-all-stringops to build crtfastmath.o. For
> > some targets, we don't want to link against libc to use memset
> > routine.
> >
> > The patch is OK with above change, but please wait a day or two for
> > possilbe comments from Jan, as he is the original author of stringops
> > code.
>
> Thanks, the below is what I committed.
>
> -Nathan
>
> gcc/
> PR 11001
> * config/i386/i386.md (strmov): Check for esi and edi usage.
> * config/i386/i386.c (decide_alg): Check whether we can use a
> rep prefix and adjust algorithm choice accordingly.
> (ix86_expand_strlen): Check for eax, ecx, and edi usage.
>
> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c (revision 129263)
> +++ gcc/config/i386/i386.c (working copy)
> @@ -15056,21 +15056,32 @@ decide_alg (HOST_WIDE_INT count, HOST_WI
> int *dynamic_check)
> {
> const struct stringop_algs * algs;
> + /* Algorithms using the rep prefix want at least edi and ecx;
> + additionally, memset wants eax and memcpy wants esi. Don't
> + consider such algorithms if the user has appropriated those
> + registers for their own purposes. */
> + bool rep_prefix_usable = !(global_regs[2] || global_regs[5]
> + || (memset ? global_regs[0] : global_regs[4]));
> +
> +
> + /* Can't use this if the user has appropriated eax, ecx, or edi. */
> + if (global_regs[0] || global_regs[2] || global_regs[5])
> + return false;
> +
Can you use/add AX_REG, CX_REG, DI_REG, SI_REG instead using 0, 2,
4, 5?
Thanks.
H.J.