On 07/20/2017 12:59 AM, Martin Liška wrote: > Hello. > > Following patch does sharing of expansion for mem{p,}cpy and also strpcy > (with a known constant as source) > so that we use same type of expansion (direct insns emission, direct emission > with a loop instruction and > library call). As mentioned in the PR, glibc does not provide an optimized > version for majority of targets. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? > Martin > > gcc/testsuite/ChangeLog: > > 2017-07-17 Martin Liska <mli...@suse.cz> > > PR middle-end/70140 > * gcc.dg/string-opt-1.c: Adjust test-case to scan for memcpy. > > gcc/ChangeLog: > > 2017-07-17 Martin Liska <mli...@suse.cz> > > PR middle-end/70140 > * builtins.c (expand_builtin_memcpy_args): Remove. > (expand_builtin_memcpy): Call newly added function > expand_builtin_memory_copy_args. > (expand_builtin_memcpy_with_bounds): Likewise. > (expand_builtin_mempcpy): Remove last argument. > (expand_builtin_mempcpy_with_bounds): Likewise. > (expand_builtin_memory_copy_args): New function created from > expand_builtin_mempcpy_args with small modifications. > (expand_builtin_mempcpy_args): Remove. > (expand_builtin_stpcpy): Remove unused argument. > (expand_builtin): Likewise. > (expand_builtin_with_bounds): Likewise.
> > > diff --git a/gcc/builtins.c b/gcc/builtins.c > index 2deef725620..016f68d2cb6 100644 > --- a/gcc/builtins.c > +++ b/gcc/builtins.c > @@ -3493,94 +3419,103 @@ expand_builtin_mempcpy_with_bounds (tree exp, rtx > target, machine_mode mode) > } > } > > -/* Helper function to do the actual work for expand_builtin_mempcpy. The > - arguments to the builtin_mempcpy call DEST, SRC, and LEN are broken out > - so that this can also be called without constructing an actual CALL_EXPR. > - The other arguments and return value are the same as for > - expand_builtin_mempcpy. */ > +/* Helper function to do the actual work for expand of memory copy family > + functions (memcpy, mempcpy, stpcpy). Expansing should assign LEN bytes "Expansing"? OK with the nit fixed. Jeff