public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Missing optimization: mempcpy(3) vs memcpy(3)
@ 2022-12-12 14:34 Wilco Dijkstra
  2022-12-12 14:57 ` Cristian Rodríguez
  0 siblings, 1 reply; 11+ messages in thread
From: Wilco Dijkstra @ 2022-12-12 14:34 UTC (permalink / raw)
  To: Alejandro Colomar (man-pages); +Cc: 'GNU C Library', gcc

Hi,

I don't believe there is a missing optimization here: compilers expand mempcpy
by default into memcpy since that is the standard library call. That means even
if your source code contains mempcpy, there will never be any calls to mempcpy.

The reason is obvious: most targets support optimized memcpy in the C library
while very few optimize mempcpy. The same is true for bzero, bcmp and bcopy.

Targets can do it differently, IIRC x86 is the only target that emits calls both to
memcpy and mempcpy.

Cheers,
Wilco

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-12-12 17:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <fdc766b8-7cfd-806b-3602-53e1ba9b277e@gmail.com>
     [not found] ` <8f9d61cf-14a5-4099-e2b6-7c8cac47a28b@suse.cz>
2022-12-12 13:44   ` Missing optimization: mempcpy(3) vs memcpy(3) Alejandro Colomar
2022-12-12 13:56     ` Jakub Jelinek
2022-12-12 14:05       ` Alejandro Colomar
2022-12-12 14:48         ` Jonathan Wakely
2022-12-12 14:53           ` Jakub Jelinek
2022-12-12 15:56             ` Alejandro Colomar
2022-12-12 16:09               ` Jakub Jelinek
2022-12-12 17:15                 ` Alejandro Colomar
2022-12-12 17:42                 ` Jonathan Wakely
2022-12-12 14:34 Wilco Dijkstra
2022-12-12 14:57 ` Cristian Rodríguez

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).