* Re: V2 [PATCH] x86-64: Avoid rep movsb with short distance [BZ #27130]
[not found] ` <87wnwsk8lh.fsf@oldenburg2.str.redhat.com>
@ 2021-01-04 15:54 ` H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-01-04 15:54 UTC (permalink / raw)
To: Florian Weimer, Libc-stable Mailing List; +Cc: H.J. Lu via Libc-alpha
On Mon, Jan 4, 2021 at 7:47 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Mon, Jan 4, 2021 at 7:22 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu via Libc-alpha:
> >>
> >> > 1:
> >> > +# if AVOID_SHORT_DISTANCE_REP_MOVSB
> >> > + movq %rsi, %rcx
> >> > + subq %rdi, %rcx
> >> > +2:
> >> > +/* Avoid "rep movsb" if RCX, the distance between source and destination,
> >> > + is N*4GB + [1..63] with N >= 0. */
> >> > + cmpl $63, %ecx
> >> > + jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */
> >> > +# endif
> >> > mov %RDX_LP, %RCX_LP
> >> > rep movsb
> >> > L(nop):
> >>
> >> Why not use _LP names here? I think the %ecx comparison at least can
> >> give false results on x86-64 (64-bit).
> >>
> >
> > This is done on purpose since we want to avoid "rep movsb" for distances of
> > N*4GB + [1..63] with N >= 0 which include 0x100000003.
>
> Ah, and the comment is quite clear (the commit subject less so).
It isn't easy to describe it with so few letters.
> I tried to make sense of the assembler code, and I think the change is
> okay because L(movsb) is only reached when there is more to copy than
> twice the vector size.
>
That is correct. I am checking it in. I will backport it to release branches
next week.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-04 15:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210104151706.2129490-1-hjl.tools@gmail.com>
[not found] ` <874kjwloah.fsf@oldenburg2.str.redhat.com>
[not found] ` <CAMe9rOqENAGBdV6Kuz+4dW5aoR3CR38-qyqiN76jcWhETUt8Cw@mail.gmail.com>
[not found] ` <87wnwsk8lh.fsf@oldenburg2.str.redhat.com>
2021-01-04 15:54 ` V2 [PATCH] x86-64: Avoid rep movsb with short distance [BZ #27130] H.J. Lu
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).