From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: "post@ralfj.de" <post@ralfj.de>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>
Subject: Support for memcpy with equal source and destination
Date: Mon, 27 Nov 2023 14:38:08 +0000 [thread overview]
Message-ID: <PAWPR08MB8982C51BF82A3F2510C396E283BDA@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)
Hi Ralf,
> However, at that point it seems unclear why that branch should live inside
> `memcpy`, rather than being performed by the caller. The entire argument made
> all along by compiler developers (as I understood it) was that the existing
> `memcpy` are already working fine for the src==dest case; if new branches need
> to be added, that's a different discussion.
Existing implementations don't need (or want) any extra branches. We also don't
want to complicate inline memcpy expansions. They all work fine if src==dst.
Paul's example was to show that with restrict you could write a conformant
C implementation. I think it is sufficient to cast away restrict without adding an
extra branch (the existing generic C version does this).
>> When n is zero, this implementation also supports NULL dest or src, though
>> that's a separate issue.
>
> Yeah I'd like to see that guarantee as well, if possible. :)
That should also work fine on existing implementations.
Cheers,
Wilco
next reply other threads:[~2023-11-27 14:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 14:38 Wilco Dijkstra [this message]
2023-11-27 14:45 ` Ralf Jung
2023-11-27 14:53 ` Zack Weinberg
2023-11-27 15:02 ` enh
-- strict thread matches above, loose matches on Subject: below --
2023-11-27 19:28 Aaron Peter Bachmann
2023-11-27 19:39 ` Paul Eggert
2023-11-23 12:14 Adhemerval Zanella Netto
2023-11-25 7:48 ` Paul Eggert
2023-11-25 8:20 ` Ralf Jung
2023-11-25 17:11 ` Paul Eggert
2023-11-27 11:15 ` Ralf Jung
2023-11-27 11:46 ` Alexander Monakov
2023-11-27 12:34 ` Ralf Jung
2023-11-27 14:25 ` Alexander Monakov
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=PAWPR08MB8982C51BF82A3F2510C396E283BDA@PAWPR08MB8982.eurprd08.prod.outlook.com \
--to=wilco.dijkstra@arm.com \
--cc=libc-alpha@sourceware.org \
--cc=post@ralfj.de \
/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).