public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: "H.J. Lu" <hjl.tools@gmail.com>,
	 "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>,
	GCC Development <gcc@gcc.gnu.org>,
	 Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH] x86-64: Optimize memset for zeroing
Date: Fri, 31 Dec 2021 15:15:57 -0600	[thread overview]
Message-ID: <CAFUsyfJ4KgiFjP1Fpt_Dg2spkDiiwcO7+98yS0Gms9oxRmS05w@mail.gmail.com> (raw)
In-Reply-To: <878rw0fpxm.fsf@mid.deneb.enyo.de>

On Fri, Dec 31, 2021 at 3:02 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu:
>
> > On Fri, Dec 31, 2021 at 12:43 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > bzero is an alias of SSE2 memset in glibc.   Should we add __memsetzero
> >> > like __memcmpeq?  It should be almost free in glibc.  GCC can use
> >> > __memsetzero if it is available.

Think __memsetzero makes sense.
> >>
> >> bzero does not have the interface ambiguity that bcmp has.  So the
> >> only reason for not using it would be namespace cleanliness.
> >
> > bzero isn't a standard C function and it isn't optimized like memset
> > in glibc.

It could be an issue if the "optimization" was made and then the
binary was run with an older version of GCC that was still using
the aliasing bzero. Would end up being a deoptimization then.


>
> GCC already uses non-standard functions whose names are not
> implementation-defined for optimization purposes if a suitable
> prototype is available.  stpcpy is an example, for:
>
>   strcpy (a, b);
>   return a + strlen (a);

  reply	other threads:[~2021-12-31 21:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211231182010.107040-1-hjl.tools@gmail.com>
     [not found] ` <CAFUsyfJ5wHJHkfcL84j+GLCX-Dba4qVt_RuCpu=aLy7-_YbHLA@mail.gmail.com>
2021-12-31 20:35   ` H.J. Lu
2021-12-31 20:43     ` Florian Weimer
2021-12-31 20:52       ` H.J. Lu
2021-12-31 21:02         ` Florian Weimer
2021-12-31 21:15           ` Noah Goldstein [this message]
2021-12-31 22:05             ` Florian Weimer
2021-12-31 22:14     ` Noah Goldstein
2021-12-31 22:19       ` Noah Goldstein
2021-12-31 22:21         ` H.J. Lu

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=CAFUsyfJ4KgiFjP1Fpt_Dg2spkDiiwcO7+98yS0Gms9oxRmS05w@mail.gmail.com \
    --to=goldstein.w.n@gmail.com \
    --cc=arjan@linux.intel.com \
    --cc=fw@deneb.enyo.de \
    --cc=gcc@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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).