Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-22 Thread Noah Goldstein via Gcc
On Wed, Sep 22, 2021 at 12:46 PM Christoph Müllner wrote: > Would it make sense to extend this proposal to include __strcmpeq() > and __strncmpeq()? > > Both are already available internally in GCC in form of > BUILT_IN_STRCMP_EQ and BUILT_IN_STRNCMP_EQ > (tree-ssa-strlen.c detects them in handle

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-22 Thread Christoph Müllner via Gcc
Would it make sense to extend this proposal to include __strcmpeq() and __strncmpeq()? Both are already available internally in GCC in form of BUILT_IN_STRCMP_EQ and BUILT_IN_STRNCMP_EQ (tree-ssa-strlen.c detects them in handle_builtin_string_cmp() and builtins.c tries to inline them in expand_bui

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-21 Thread Noah Goldstein via Gcc
On Fri, Sep 17, 2021 at 9:27 AM Florian Weimer via Libc-alpha < libc-al...@sourceware.org> wrote: > * Joseph Myers: > > > I was supposing a build-time decision (using > GCC_GLIBC_VERSION_GTE_IFELSE > > to know if the glibc version on the target definitely has this > function). > > But if we add a

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-20 Thread Zack Weinberg via Gcc
On Fri, Sep 17, 2021, at 9:36 PM, James Y Knight via Libc-alpha wrote: > Glibc currently implements bcmp as an alias to memcmp -- which is valid, > but provides more than just the boolean equality semantics. There was > concern raised that modifying that might break existing binaries. However, > th

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread James Y Knight via Gcc
On Thu, Sep 16, 2021 at 5:50 PM enh wrote: > plus testing for _equality_ can (as mentioned earlier) have slightly > different properties from the three-way comparator behavior of > bcmp()/memcmp(). > Per spec, bcmp is not a three-way comparison, it is an equality comparison with exactly the same

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Noah Goldstein via Gcc
On Fri, Sep 17, 2021 at 3:32 AM Richard Biener via Gcc wrote: > On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer > wrote: > > > > * Richard Biener via Gcc: > > > > > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers > wrote: > > >> > > >> On Thu, 16 Sep 2021, Chris Kennelly wrote: > > >> > > >> > In

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Martin Sebor via Gcc
On 9/17/21 3:12 AM, Jakub Jelinek via Gcc wrote: On Fri, Sep 17, 2021 at 10:08:34AM +0200, Florian Weimer via Gcc wrote: So the compiler would emit a call to __memcmpeq and at the same time emit a weak alias of __memcmpeq to memcmp so the program links when the libc version targeted does not pro

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Florian Weimer via Gcc
* Joseph Myers: > I was supposing a build-time decision (using GCC_GLIBC_VERSION_GTE_IFELSE > to know if the glibc version on the target definitely has this function). > But if we add a header declaration, you could check for __memcmpeq being > declared (and so cover arbitrary C libraries, not

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Joseph Myers
On Fri, 17 Sep 2021, Richard Biener via Gcc wrote: > when the libc version targeted does not provide __memcmpeq? Or would > glibc through magically communicate the availability of the new ABI > without actually declaring the function? > (I'm not sure whether a GCC build-time decision via configu

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Richard Biener via Gcc
On Fri, Sep 17, 2021 at 10:37 AM Florian Weimer wrote: > > * Richard Biener: > > > On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer wrote: > >> > >> * Richard Biener via Gcc: > >> > >> > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers > >> > wrote: > >> >> > >> >> On Thu, 16 Sep 2021, Chris Kennel

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Jakub Jelinek via Gcc
On Fri, Sep 17, 2021 at 10:08:34AM +0200, Florian Weimer via Gcc wrote: > > So the compiler would emit a call to __memcmpeq and at the same time > > emit a weak alias of __memcmpeq to memcmp so the program links > > when the libc version targeted does not provide __memcmpeq? Or would > > glibc thr

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Florian Weimer via Gcc
* Richard Biener: > On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer wrote: >> >> * Richard Biener via Gcc: >> >> > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers >> > wrote: >> >> >> >> On Thu, 16 Sep 2021, Chris Kennelly wrote: >> >> >> >> > In terms of relying on the feature: If __memcmpeq is

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Richard Biener via Gcc
On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer wrote: > > * Richard Biener via Gcc: > > > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers > > wrote: > >> > >> On Thu, 16 Sep 2021, Chris Kennelly wrote: > >> > >> > In terms of relying on the feature: If __memcmpeq is ever exposed as an > >> > a

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Florian Weimer via Gcc
* Richard Biener via Gcc: > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers wrote: >> >> On Thu, 16 Sep 2021, Chris Kennelly wrote: >> >> > In terms of relying on the feature: If __memcmpeq is ever exposed as an a >> > simple alias for memcmp (since the notes mention that it's a valid >> > impleme

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-17 Thread Richard Biener via Gcc
On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers wrote: > > On Thu, 16 Sep 2021, Chris Kennelly wrote: > > > In terms of relying on the feature: If __memcmpeq is ever exposed as an a > > simple alias for memcmp (since the notes mention that it's a valid > > implementation), does that open up the pos

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Noah Goldstein via Gcc
On Thu, Sep 16, 2021 at 5:25 PM Chris Kennelly via Libc-alpha < libc-al...@sourceware.org> wrote: > On Thu, Sep 16, 2021 at 5:50 PM enh wrote: > > > plus testing for _equality_ can (as mentioned earlier) have slightly > > different properties from the three-way comparator behavior of > > bcmp()/m

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Joseph Myers
On Thu, 16 Sep 2021, Chris Kennelly wrote: > The mem* functions are extremely sensitive to instruction cache effects, so > having 3 unique implementations (__memcmpeq, bcmp, memcmp) that do similar, I don't think anyone is suggesting 3 unique implementations. The obsolescent name bcmp would be

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Chris Kennelly via Gcc
On Thu, Sep 16, 2021 at 5:50 PM enh wrote: > plus testing for _equality_ can (as mentioned earlier) have slightly > different properties from the three-way comparator behavior of > bcmp()/memcmp(). > llvm-libc's implementation only returns the boolean, though. The mem* functions are extremely s

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Noah Goldstein via Gcc
On Thu, Sep 16, 2021, 4:50 PM enh via Libc-alpha wrote: > plus testing for _equality_ can (as mentioned earlier) have slightly > different properties from the three-way comparator behavior of > bcmp()/memcmp(). > How does bcmp() have a three-way comparator? Or do you mean how it is currently im

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread enh via Gcc
plus testing for _equality_ can (as mentioned earlier) have slightly different properties from the three-way comparator behavior of bcmp()/memcmp(). On Thu, Sep 16, 2021 at 2:43 PM Joseph Myers wrote: > On Thu, 16 Sep 2021, James Y Knight wrote: > > > Wouldn't it be far simpler to just un-deprec

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Joseph Myers
On Thu, 16 Sep 2021, James Y Knight wrote: > Wouldn't it be far simpler to just un-deprecate bcmp? The aim is to have something to which calls can be generated in all standards modes. bcmp has never been part of ISO C; there's nothing to undeprecate there. -- Joseph S. Myers jos...@codesourc

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread James Y Knight via Gcc
Wouldn't it be far simpler to just un-deprecate bcmp? On Thu, Sep 16, 2021 at 1:04 PM Noah Goldstein wrote: > Hi All, > > This is a proposal for a new interface to be supported by libc. > > The new interface is the same as the old 'bcmp()' routine. Essentially > the goal of this proposal is to a

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread enh via Gcc
(Android libc maintainer.) should __memcmpeq be in compiler-rt rather than libc? On Thu, Sep 16, 2021 at 1:35 PM Joseph Myers wrote: > On Thu, 16 Sep 2021, Chris Kennelly wrote: > > > In terms of relying on the feature: If __memcmpeq is ever exposed as an > a > > simple alias for memcmp (since

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Joseph Myers
On Thu, 16 Sep 2021, Chris Kennelly wrote: > In terms of relying on the feature: If __memcmpeq is ever exposed as an a > simple alias for memcmp (since the notes mention that it's a valid > implementation), does that open up the possibility of depending on the > bcmp-like behavior that we were tr

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Chris Kennelly via Gcc
On Thu, Sep 16, 2021 at 2:31 PM Noah Goldstein wrote: > > > On Thu, Sep 16, 2021 at 12:55 PM Chris Kennelly via Libc-alpha < > libc-al...@sourceware.org> wrote: > >> On Thu, Sep 16, 2021 at 1:04 PM Noah Goldstein >> wrote: >> >> > Hi All, >> > >> > This is a proposal for a new interface to be su

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Noah Goldstein via Gcc
On Thu, Sep 16, 2021 at 12:55 PM Chris Kennelly via Libc-alpha < libc-al...@sourceware.org> wrote: > On Thu, Sep 16, 2021 at 1:04 PM Noah Goldstein > wrote: > > > Hi All, > > > > This is a proposal for a new interface to be supported by libc. > > > > The new interface is the same as the old 'bcmp

Re: [libc-coord] Add new ABI '__memcmpeq()' to libc

2021-09-16 Thread Chris Kennelly via Gcc
On Thu, Sep 16, 2021 at 1:04 PM Noah Goldstein wrote: > Hi All, > > This is a proposal for a new interface to be supported by libc. > > The new interface is the same as the old 'bcmp()' routine. Essentially > the goal of this proposal is to add a reserved namespace for a new > function, '__memcmp