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: Richard Biener <rguenther at suse dot de>
- To: Martin Liška <mliska at suse dot cz>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>, gcc-patches at gcc dot gnu dot org, Marc Glisse <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 15:52:09 +0200 (CEST)
- Subject: Re: [PATCH] Prefer mempcpy to memcpy on x86_64 target (PR middle-end/81657).
- References: <4ca9c192-84f2-95ba-ffd7-1c9aa9be1dfd@suse.cz> <20180321103425.GJ8577@tucnak> <aeef50db-3550-08b3-22c4-4067696abe08@suse.cz> <20180328143114.GK8577@tucnak> <adc4fa95-1f8e-67ae-ffeb-81c1f239674b@suse.cz> <20180328163652.GL8577@tucnak> <772b1171-2321-67d9-85e7-358a5cad0efa@suse.cz> <20180329122532.GP8577@tucnak> <17bbc039-e511-4fbe-d534-3d6d21aadc00@suse.cz> <2d812eaf-8ea0-68e8-089b-0c3d89a203d8@suse.cz> <20180410091915.GA8577@tucnak> <fbd9f1ef-34c6-45e1-b5ae-5acb3b828788@suse.cz> <5b750aa0-c5f6-0e64-9a14-5667926bcf3f@suse.cz>
On Thu, 12 Apr 2018, Martin Liška wrote:
> Hi.
>
> I'm reminding review request from Richi for generic part
> and Uros/Honza for target part.
Not sure if I missed some important part of the discussion but
for the testcase we want to preserve the tailcall, right? So
it would be enough to set avoid_libcall to
endp != 0 && CALL_EXPR_TAILCALL (exp) (and thus also handle
stpcpy)?
I'm not sure I like the interfacing of that to emit_block_move_hints
very much. I'd have used sth like BLOCK_OP_ABORT_ON_LIBCALL
and extend the interface in a way to return what kind of method it
chose rather than just a bool.
Not sure what gcc.dg/20050503-1.c did on non-x86 targets - the
test runs on all archs but only x86 is ever tested for a result.
So - I think tail-calling is prefered, and somehow in the PR
the discussion wandered off to whether there's fast implementations
or not - but the testcase looks for a tailcall where the source
was a tailcall, that should be authorative for the "default"
decision when the hook isn't implemented or doesn't cover the case.
IMO target libraries have to be quite stupid if they have anything
slower than
void *mempcpy (void *dest, const void *src, size_t n)
{
return memcpy (dest, src, n) + n;
}
which should be not (very much) slower than a non-tailcall memcpy call.
So -- remove the hook and instead use CALL_EXPR_TAILCALL (exp) instead
of its result.
Thanks,
Richard.