public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Fangrui Song <maskray@google.com>,
	Noah Goldstein <goldstein.w.n@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [PATCH] Add -fextra-libc-function=memcmpeq for __memcmpeq
Date: Mon, 20 Jun 2022 08:45:42 -0700	[thread overview]
Message-ID: <CAMe9rOrGxTEirbLT-tveMLihZ10j9NWWvTkuDAYmYiA29=SxOQ@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc0kCPU9FZvbyb3gxqyj-4zcGkOV=y_Y6_N-VmJFip9V+Q@mail.gmail.com>

On Mon, Jun 20, 2022 at 2:39 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Thu, Jun 16, 2022 at 1:38 AM Fangrui Song <maskray@google.com> wrote:
> >
> > On Wed, Jun 15, 2022 at 2:44 PM H.J. Lu via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > On Mon, Jun 13, 2022 at 9:01 AM Richard Biener
> > > <richard.guenther@gmail.com> wrote:
> > > >
> > > >
> > > >
> > > > > Am 13.06.2022 um 16:36 schrieb H.J. Lu <hjl.tools@gmail.com>:
> > > > >
> > > > > On Mon, Jun 13, 2022 at 3:11 AM Richard Biener
> > > > > <richard.guenther@gmail.com> wrote:
> > > > >>
> > > > >>> On Tue, Jun 7, 2022 at 9:02 PM H.J. Lu via Gcc-patches
> > > > >>> <gcc-patches@gcc.gnu.org> wrote:
> > > > >>>
> > > > >>> Add -fextra-libc-function=memcmpeq to map
> > > > >>>
> > > > >>> extern int __memcmpeq (const void *, const void *, size_t);
> > > > >>>
> > > > >>> which was added to GLIBC 2.35, to __builtin_memcmp_eq.
> > > > >>
> > > > >> Humm.  Can't we instead use the presence of a declaration
> > > > >> of __memcmpeq with a GNU standard dialect as this instead of
> > > > >> adding a weird -fextra-libc-function= option?  Maybe that's even
> > > > >> reasonable with a non-GNU dialect standard in effect since
> > > > >> __ prefixed names are in the implementation namespace?
> > > > >
> > > > > But not all source codes include <string.h> and GCC may generate
> > > > > memcmp directly.  How should we handle these cases?
> > > >
> > > > Not.  Similar as to vectorized math functions.
> > > > I think it’s not worth optimizing for this case.
> > >
> > > Another question.  Should we consider any __memcmpeq prototype
> > > or just the one in the system header file?
>
> Any.

Here is the v2 patch:

https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596881.html

> > An idea from https://reviews.llvm.org/D56593#3586673: -fbuiltin-__memcmpeq
> >
> > This requires making -fbuiltin-function available, see
> > https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
> > ("There is no corresponding -fbuiltin-function option")
> >
> > I prefer an option over a magic behavior about whether a declaration exists.
>
> But we already have this behavior for multiple cases.  It's also the only
> way that in practice __memcmpeq will be used - _nobody_ (but maybe
> special crafted SPEC peak runs) will add explicit -fbuiltin-__memcmpeq.
>
> Richard.

Thanks.

-- 
H.J.

      reply	other threads:[~2022-06-20 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 19:01 H.J. Lu
2022-06-13 10:11 ` Richard Biener
2022-06-13 14:36   ` H.J. Lu
2022-06-13 16:01     ` Richard Biener
2022-06-15 21:43       ` H.J. Lu
2022-06-15 23:38         ` Fangrui Song
2022-06-20  9:39           ` Richard Biener
2022-06-20 15:45             ` H.J. Lu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOrGxTEirbLT-tveMLihZ10j9NWWvTkuDAYmYiA29=SxOQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=goldstein.w.n@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=maskray@google.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).