[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgm+2ac4nnprPST6CnehHXScth=A7-ayrNyhydNC+xG-g@mail.gmail.com>
Date: Tue, 28 Jan 2020 11:51:56 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Ingo Molnar <mingo@...nel.org>, Tony Luck <tony.luck@...el.com>,
Borislav Petkov <bp@...e.de>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL] x86/asm changes for v5.6
On Tue, Jan 28, 2020 at 8:59 AM Ingo Molnar <mingo@...nel.org> wrote:
>
> - Add support for "Fast Short Rep Mov", which is available starting with
> Ice Lake Intel CPUs - and make the x86 assembly version of memmove()
> use REP MOV for all sizes when FSRM is available.
Pulled. However, this seems rather non-optimal:
ALTERNATIVE "cmp $0x20, %rdx; jb 1f", "", X86_FEATURE_FSRM
ALTERNATIVE "", "movq %rdx, %rcx; rep movsb; retq", X86_FEATURE_ERMS
in that it leaves unnecessary NOP's there as alternatives.
We have "ALTERNATIVE_2", so we can do the above in one thing, _and_
move the rep-movsq testing code into there too:
ALTERNATIVE_2 \
"cmp $680, %rdx ; jb 3f ; cmpb %dil, %sil; je 4f", \
"movq %rdx, %rcx ; rep movsb; retq", X86_FEATURE_FSRM, \
"cmp $0x20, %rdx; jb 1f; movq %rdx, %rcx; rep movsb;
retq", X86_FEATURE_ERMS
which avoids unnecessary nops.
I dunno. It doesn't much matter, but we _do_ have things to do for
all three cases, and it actually makes sense to move all the three
"use rep movs" cases into the ALTERNATIVE. No?
UNTESTED patch attached, but visually it seems to generate better code
and less unnecessary nops (I get just two bytes of nop with this for
the nonFSRM/ERMS case)
If somebody tests this out and commits it and writes a commit message,
they can claim authorship. Or add my sign-off.
Linus
View attachment "patch.diff" of type "text/x-patch" (1186 bytes)
Powered by blists - more mailing lists