This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Prefer mempcpy to memcpy on x86_64 target (PR middle-end/81657).
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, nd <nd at arm dot com>, "mliska at suse dot cz" <mliska at suse dot cz>, "ubizjak at gmail dot com" <ubizjak at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "marc dot glisse at inria dot fr" <marc dot glisse at inria dot fr>, "H.J. Lu" <hjl dot tools at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 12 Apr 2018 16:30:07 +0000
- Subject: Re: [PATCH] Prefer mempcpy to memcpy on x86_64 target (PR middle-end/81657).
- Nodisclaimer: True
- References: <DB6PR0801MB205332C2713586CB5120F0AE83BC0@DB6PR0801MB2053.eurprd08.prod.outlook.com>,<20180412160306.GN8577@tucnak>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Jakub Jelinek wrote:
> On Thu, Apr 12, 2018 at 03:53:13PM +0000, Wilco Dijkstra wrote:
>> The tailcall issue is just a distraction. Historically the handling of mempcpy
>> has been horribly inefficient in both GCC and GLIBC for practically all targets.
>> This is why it was decided to defer to memcpy.
>
> I guess we need to agree to disagree. But we have a P1 PR that we need to
> resolve and it is one of the last 6 blockers we have. I'm not suggesting to
> revert PR70140, just let use mempcpy libcall if it is what the user wrote and
> we aren't expanding it inline.
Frankly I don't see why it is a P1 regression. Do you have a benchmark that
regresses significantly (a few percent, not by a few bytes)? I already showed
the AArch64 results for GLIBC, do you have x86 results that prove things are
much worse?
>> So generally it's a good idea to change mempcpy into memcpy by default. It's
>> not slower than calling mempcpy even if you have a fast implementation, it's faster
>> if you use an up to date GLIBC which calls memcpy, and it's significantly better
>> when using an old GLIBC.
>
> mempcpy is quite good on many targets even in old GLIBCs.
Only true if with "many" you mean x86, x86_64 and IIRC sparc.
Wilco