On 5/20/19 10:43 AM, Rainer Orth wrote: > Hi Martin, > >> On 5/14/19 5:07 PM, Martin Sebor wrote: >>> On 5/14/19 8:55 AM, Martin Liška wrote: >>>> On 5/13/19 3:07 PM, Jakub Jelinek wrote: >>>>> On Mon, May 13, 2019 at 12:14:37PM +0200, Martin Liška wrote: >>>>>> On 5/10/19 11:21 AM, Jakub Jelinek wrote: >>>>>>> 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 >>>>>> >>>>>> Done. >>>>>> >>>>>>> 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) >>>>>> >>>>>> I've implemented the in i386.c with DEFAULT_LIBC == LIBC_GLIBC. Hope >>>>>> it's correct? >>>>> >>>>> No, that would be correct only in the rare SINGLE_LIBC configurations. >>>>> Either you can do >>>>> #ifdef OPTION_GLIBC >>>>> return OPTION_GLIBC; >>>>> #else >>>>> return false; >>>>> #endif >>>>> or define something in config/linux.h (or .[ch]) that you can then use in >>>>> i386.c. >>>>> >>>>> Jakub >>>>> >>>> >>>> Hi. >>>> >>>> You always have nice ideas. I'm sending updated patch which addresses >>>> both Jakub's >>>> and Wilco's comments. >>>> >>> >>> index 66cee075018..7bff5cbd313 100644 >>> --- a/gcc/target.def >>> +++ b/gcc/target.def >>> @@ -5797,6 +5797,12 @@ DEFHOOK >>> const char *, (void), >>> hook_constcharptr_void_null) >>> >>> +DEFHOOK >>> +(has_fast_mempcpy_routine, >>> + "Return true if a target has a fast mempcpy routine.", >>> + bool, (void), >>> + hook_bool_void_false) >>> + >>> >>> Not to be too nit-picky about the name but target.def refers to >>> functions rather than routines. It also defines a hook called >>> libc_has_function with the obvious semantics so if there's >>> a chance that it could be useful to query whether another libc >>> function is "fast" I would suggest to consider defining the hook >>> correspondingly, i.e., >>> >>> bool libc_has_fast_function (enum function_class) >>> >>> and naming the macro similarly. >>> >>> Martin >> >> Hi Martin. >> >> That's a very good suggestion and I'm implementing that! >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > as usual, the new effective-target keyworks needs documenting in > sourcebuild.texi.
Hi. It's not a target keywords, but it's a new hook. I've briefly read the file and I can't find any other hooks mentioned in the file. Martin > Besides, it doesn't seem to be a very useful property > of a target, just a collection for all sorts of properties where we are > too lazy to introduce a new one that really describes what this is > about... > > Rainer >