Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Jonathan Wakely via Gcc
On Mon, 12 Dec 2022 at 16:10, Jakub Jelinek wrote: > > On Mon, Dec 12, 2022 at 04:56:27PM +0100, Alejandro Colomar wrote: > > "Names beginning with ‘str’, ‘mem’, or ‘wcs’ followed by a lowercase letter > > are reserved for additional string and array functions. See String and Array > > Utilities."

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Alejandro Colomar via Gcc
Hi Jakub, On 12/12/22 17:09, Jakub Jelinek wrote: On Mon, Dec 12, 2022 at 04:56:27PM +0100, Alejandro Colomar wrote: "Names beginning with ‘str’, ‘mem’, or ‘wcs’ followed by a lowercase letter are reserved for additional string and array functions. See String and Array Utilities." It is not t

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Jakub Jelinek via Gcc
On Mon, Dec 12, 2022 at 04:56:27PM +0100, Alejandro Colomar wrote: > "Names beginning with ‘str’, ‘mem’, or ‘wcs’ followed by a lowercase letter > are reserved for additional string and array functions. See String and Array > Utilities." It is not that simple. mem*, str* and wcs* are just potentia

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Alejandro Colomar via Gcc
Hi Jonathan and Jakub, On 12/12/22 15:53, Jakub Jelinek wrote: On Mon, Dec 12, 2022 at 02:48:35PM +, Jonathan Wakely wrote: On Mon, 12 Dec 2022 at 14:09, Alejandro Colomar wrote: On 12/12/22 14:56, Jakub Jelinek wrote: I think that is the case, plus the question if one can use a non-sta

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Cristian Rodríguez via Gcc
On Mon, Dec 12, 2022 at 11:35 AM Wilco Dijkstra via Libc-alpha wrote: > > 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 n

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Jakub Jelinek via Gcc
On Mon, Dec 12, 2022 at 02:48:35PM +, Jonathan Wakely wrote: > On Mon, 12 Dec 2022 at 14:09, Alejandro Colomar wrote: > > On 12/12/22 14:56, Jakub Jelinek wrote: > > > > I think that is the case, plus the question if one can use a non-standard > > > function to implement a standard function (a

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Jonathan Wakely via Gcc
On Mon, 12 Dec 2022 at 14:09, Alejandro Colomar wrote: > On 12/12/22 14:56, Jakub Jelinek wrote: > > I think that is the case, plus the question if one can use a non-standard > > function to implement a standard function (and if it would be triggered > > by seeing an expected prototype for the non

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Alejandro Colomar via Gcc
Hi Jakub, On 12/12/22 14:56, Jakub Jelinek wrote: On Mon, Dec 12, 2022 at 02:44:04PM +0100, Alejandro Colomar via Gcc wrote: I don't see any problem with the code snippets you provided. Well, then the optimization may be the other way around (although I question why it is implemented that way

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Jakub Jelinek via Gcc
On Mon, Dec 12, 2022 at 02:44:04PM +0100, Alejandro Colomar via Gcc wrote: > > I don't see any problem with the code snippets you provided. > > Well, then the optimization may be the other way around (although I question > why it is implemented that way, and not the other way around, but I'm not a

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Alejandro Colomar via Gcc
Hi Martin, On 12/12/22 14:37, Martin Liška wrote: On 12/9/22 18:11, Alejandro Colomar via Gcc wrote: I expect the compiler to be knowledgeable enough to call whatever is fastest, whatever it is, but be consistent in both cases.  However, here are the results: Hi. Note the glibc implementati

Re: Missing optimization: mempcpy(3) vs memcpy(3)

2022-12-12 Thread Martin Liška
On 12/9/22 18:11, Alejandro Colomar via Gcc wrote: > I expect the compiler to be knowledgeable enough to call whatever is fastest, > whatever it is, but be consistent in both cases.  However, here are the  > results: Hi. Note the glibc implementation of mempcpy typically uses (calls) memcpy, thu