[PATCH] x86-64: Add Avoid_Short_Distance_REP_MOVSB

Noah Goldstein goldstein.w.n@gmail.com
Sat Aug 28 02:57:30 GMT 2021


On Fri, Aug 27, 2021 at 8:28 PM Alexey Tourbin via Libc-alpha <
libc-alpha@sourceware.org> wrote:

> On Mon, Jul 26, 2021 at 3:03 PM H.J. Lu via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> > --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> > +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
> > @@ -325,12 +325,16 @@ L(movsb):
> >         /* Avoid slow backward REP MOVSB.  */
> >         jb      L(more_8x_vec_backward)
> >  # if AVOID_SHORT_DISTANCE_REP_MOVSB
> > +       andl    $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB,
> __x86_string_control(%rip)
> > +       jz      3f
> >         movq    %rdi, %rcx
> >         subq    %rsi, %rcx
> >         jmp     2f
> >  # endif
> >  1:
> >  # if AVOID_SHORT_DISTANCE_REP_MOVSB
> > +       andl    $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB,
> __x86_string_control(%rip)
> > +       jz      3f
> >         movq    %rsi, %rcx
> >         subq    %rdi, %rcx
> >  2:
>
> Why "andl" rather than "testl"?
>

+1. I missed that before.

My patches: [PATCH 5/5] X86-64: Optimize memmove-vec-unaligned-erms.S

uses `testl` instead. Although my patch might not be checked in (and it may
be a
while) as we are still looking into the causes of the slowdown.


More information about the Libc-alpha mailing list