On Fri, May 10, 2019 at 11:04:12AM +0200, Martin Liška wrote: > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -1906,6 +1906,9 @@ typedef struct ix86_args { > > #define CLEAR_RATIO(speed) ((speed) ? MIN (6, ix86_cost->move_ratio) : 2) > > +/* C library provides fast implementation of mempcpy function. */ > +#define TARGET_HAS_FAST_MEMPCPY_ROUTINE 1 > +
1) we shouldn't be adding further target macros, but target hooks 2) I don't think this is a property of the x86 target, but of x86 glibc, so you should set it on x86 glibc only (i.e. i?86/x86_64 linux and hurd when using glibc, not newlib, nor bionic/android, nor uclibc, nor musl) > --- a/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/mempcpy.c > @@ -56,9 +56,8 @@ main_test (void) > if (__builtin_mempcpy (p, "ABCDE", 6) != p + 6 || memcmp (p, "ABCDE", 6)) > abort (); > > - /* If the result of mempcpy is ignored, gcc should use memcpy. > - This should be optimized always, so set inside_main again. */ > - inside_main = 1; > + /* Set inside main in order to not abort because of usafe of mempcpy. */ > + inside_main = 0; > mempcpy (p + 5, s3, 1); > if (memcmp (p, "ABCDEFg", 8)) > abort (); Why this? Do you mean mempcpy is called here, even when the lhs is unused? We should be calling memcpy in that case. Jakub