This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] use movstr in strcat
- From: Richard Henderson <rth at redhat dot com>
- To: Adrian Straetling <straetling at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, uweigand at de dot ibm dot com, krebbel1 at de dot ibm dot com
- Date: Thu, 25 Aug 2005 10:46:26 -0700
- Subject: Re: [patch] use movstr in strcat
- References: <20050825111218.GA24668@de.ibm.com>
On Thu, Aug 25, 2005 at 01:12:18PM +0200, Adrian Straetling wrote:
> * builtins.c: (expand_builtin_strcat): Add support for
> expand_movstr.
You're duplicating a lot of code here. It seems to me the best
way to approach this is to start a sequence, build the strlen
addition, and then defer to expand_builtin_strcpy. If the
expansion of the strcpy fails, abort the sequence. You may have
to play games like in expand_builtin_mathfn_2 in order to reliably
stabilize the arguments.
I'll also note for the record that it would seem like strchr(p, '\0')
would be a better expansion that p+strlen(p). But we don't appear
to have specific backend support for strchr. Or in more specific
terms, the glibc routine __rawmemchr which doesn't search for both
C and 0 simultaneously.
r~