On Wed, Jul 19, 2017 at 11:59 PM, Martin Liška <mli...@suse.cz> 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. > --- > gcc/builtins.c | 268 > ++++++++++++++---------------------- > gcc/testsuite/gcc.dg/string-opt-1.c | 51 ++++++- > 2 files changed, 147 insertions(+), 172 deletions(-) > >
I got many mempcpy test failures on Fedora 26/x86-64: #0 0xf7ddef50 in abort () from /lib/libc.so.6 #1 0x08048a95 in test (buf3=0x804b060 <buf1>, buf4=0x804b0e0 <buf1+128> "", buf6=0x8048d3c "rstuvwxyz", n=0) at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c:49 #2 0x08048b77 in main_test () at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c:152 #3 0x08048bc7 in main () at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c:10 (gdb) f 1 #1 0x08048a95 in test (buf3=0x804b060 <buf1>, buf4=0x804b0e0 <buf1+128> "", buf6=0x8048d3c "rstuvwxyz", n=0) at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy-2.c:49 49 abort (); (gdb) -- H.J.