On 04/10/2018 06:27 AM, Martin Liška wrote: > On 04/10/2018 11:19 AM, Jakub Jelinek wrote: >> On Mon, Apr 09, 2018 at 02:31:04PM +0200, Martin Liška wrote: >>> gcc/testsuite/ChangeLog: >>> >>> 2018-03-28 Martin Liska <mli...@suse.cz> >>> >>> * gcc.dg/string-opt-1.c: >> I guess you really didn't mean to keep the above entry around, just the one >> below, right? > Sure, fixed. > >>> gcc/testsuite/ChangeLog: >>> >>> 2018-03-14 Martin Liska <mli...@suse.cz> >>> >>> * gcc.dg/string-opt-1.c: Adjust scans for i386 and glibc target >>> and others. >>> --- a/gcc/config.gcc >>> +++ b/gcc/config.gcc >>> @@ -1607,6 +1607,7 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu) >>> x86_64-*-linux*) >>> tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h >>> i386/linux64.h" >>> extra_options="${extra_options} linux-android.opt" >>> + extra_objs="${extra_objs} x86-linux.o" >>> ;; >> The should go into the i[34567]86-*-linux*) case too (outside of the >> if test x$enable_targets = xall; then conditional). >> Or maybe better, remove the above and do it in: >> i[34567]86-*-linux* | x86_64-*-linux*) >> extra_objs="${extra_objs} cet.o" >> tmake_file="$tmake_file i386/t-linux i386/t-cet" >> ;; >> spot, just add x86-linux.o next to cet.o. > Done. > >>> --- a/gcc/config/i386/linux.h >>> +++ b/gcc/config/i386/linux.h >>> @@ -24,3 +24,5 @@ along with GCC; see the file COPYING3. If not see >>> >>> #undef MUSL_DYNAMIC_LINKER >>> #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" >>> + >>> +#define SUBTARGET_LIBC_FUNC_SPEED ix86_linux_libc_func_speed >>> diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h >>> index f2d913e30ac..d855f5cc239 100644 >>> --- a/gcc/config/i386/linux64.h >>> +++ b/gcc/config/i386/linux64.h >>> @@ -37,3 +37,5 @@ see the files COPYING3 and COPYING.RUNTIME respectively. >>> If not, see >>> #define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" >>> #undef MUSL_DYNAMIC_LINKERX32 >>> #define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" >>> + >>> +#define SUBTARGET_LIBC_FUNC_SPEED ix86_linux_libc_func_speed >> And the above two changes should be replaced by a change in >> gcc/config/i386/linux-common.h. > Likewise. > >>> +#include "coretypes.h" >>> +#include "cp/cp-tree.h" /* This is why we're a separate module. */ >> Why do you need cp/cp-tree.h? That is just too weird. >> The function just uses libc_speed (in core-types.h, built_in_function >> (likewise), OPTION_GLIBC (config/linux.h). > I ended up with minimal set of includes: > > #include "config.h" > #include "system.h" > #include "coretypes.h" > #include "backend.h" > #include "tree.h" > > I'm retesting the patch. > > Martin > >> Jakub >> > > 0001-Introduce-new-libc_func_speed-target-hook-PR-middle-.patch > > > From bed35715063f9435b697eaf4c9868f81e8556de8 Mon Sep 17 00:00:00 2001 > From: marxin <mli...@suse.cz> > Date: Wed, 14 Mar 2018 09:44:18 +0100 > Subject: [PATCH] Introduce new libc_func_speed target hook (PR > middle-end/81657). > > gcc/ChangeLog: > > 2018-03-14 Martin Liska <mli...@suse.cz> > > PR middle-end/81657 > * builtins.c (expand_builtin_memory_copy_args): Handle situation > when libc library provides a fast mempcpy implementation/ > * config/linux-protos.h (ix86_linux_libc_func_speed): New. > (TARGET_LIBC_FUNC_SPEED): Likewise. > * config/i386/linux-common.h (SUBTARGET_LIBC_FUNC_SPEED): Define > macro. > * config/i386/t-linux: Add x86-linux.o. > * config.gcc: Likewise. > * config/i386/x86-linux.c: New file. > * coretypes.h (enum libc_speed): Likewise. > * doc/tm.texi: Document new target hook. > * doc/tm.texi.in: Likewise. > * expr.c (emit_block_move_hints): Handle libc bail out argument. > * expr.h (emit_block_move_hints): Add new parameters. > * target.def: Add new hook. > * targhooks.c (enum libc_speed): New enum. > (default_libc_func_speed): Provide a default hook > implementation. > * targhooks.h (default_libc_func_speed): Likewise. > > gcc/testsuite/ChangeLog: > > 2018-03-14 Martin Liska <mli...@suse.cz> > > * gcc.dg/string-opt-1.c: Adjust scans for i386 and glibc target > and others. This looks pretty reasonable now. Let's go with it. If we need to adjust other targets we certainly can fault them in as their properties are discovered/updated.
jeff