public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH] elf: Replace memcmp with __memcmpeq for variable size
Date: Mon, 7 Feb 2022 20:35:43 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2202072032370.9395@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20220206210914.1593336-1-hjl.tools@gmail.com>

On Sun, 6 Feb 2022, H.J. Lu via Libc-alpha wrote:

> Replace memcmp with __memcmpeq when a boolean return is all that is
> needed.  __memcmpeq is an alias of memcmp by default and it can be
> optimized by architectures.

I don't think we should make this sort of change to glibc source code at 
all.  We should write the code to be clear for readers - meaning using the 
standard C function name, which is memcmp - and leave the compiler to 
optimize or not.

In general we should move away from writing such internal function calls 
directly in the source code, where it can reasonably call the standard 
function names instead.  Cf. how we handle things for various internal 
calls in libm: call standard names the compiler might inline (don't 
provide e.g. inline versions of those functions in glibc's internal 
headers), with asm redirection to reserved names to cover the case when 
those function calls don't get inlined.

-- 
Joseph S. Myers
joseph@codesourcery.com

  parent reply	other threads:[~2022-02-07 20:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-06 21:09 H.J. Lu
2022-02-06 22:19 ` Florian Weimer
2022-02-07  0:20   ` H.J. Lu
2022-02-07 10:40     ` Florian Weimer
2022-02-07 13:13       ` H.J. Lu
2022-02-07 13:19         ` Florian Weimer
2022-02-07 13:27           ` H.J. Lu
2022-02-07 13:30             ` Adhemerval Zanella
2022-02-07 14:00               ` H.J. Lu
2022-02-07 20:35 ` Joseph Myers [this message]
2022-02-08 22:30 Wilco Dijkstra
2022-02-08 23:00 ` Adhemerval Zanella
2022-02-09  0:07   ` Noah Goldstein
2022-02-09  1:42     ` Wilco Dijkstra

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=alpine.DEB.2.22.394.2202072032370.9395@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --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).