Re: [PATCH v12 07/11] x86/smpboot: Remove early_gdt_descr on 64-bit
From: David Woodhouse
Date: Wed Mar 01 2023 - 02:40:38 EST
On Tue, 2023-02-28 at 16:02 -0800, H. Peter Anvin wrote:
>
> > Ewww. Couldn't the assembler choose to omit the REX prefix then? It
> > does more tricksy things than that already.
> >
> > I almost prefer having the prefix but (in the morning) if you
> > prefer I can put it back as it was with a comment about the zero-
> > extension.
> >
>
> Like it or not, that's how the assembler currently works.
Last time someone told me "you can't tell the assembler what you
actually mean; you have to tell it something different" I threw my toys
out of the pram a little bit and implemented all of the 16-bit '-m16'
support in LLVM/clang.
On Tue, 2023-02-28 at 19:03 -0500, Brian Gerst wrote:
>
> commit a7bea8308933aaeea76dad7d42a6e51000417626
> Author: Jan Beulich <JBeulich@xxxxxxxx>
> Date: Mon Jul 2 04:31:54 2018 -0600
>
> x86/asm/64: Use 32-bit XOR to zero registers
>
> Some Intel CPUs don't recognize 64-bit XORs as zeroing idioms. Zeroing
> idioms don't require execution bandwidth, as they're being taken care
> of in the frontend (through register renaming). Use 32-bit XORs instead.
>
> Not that speed is important here, but it's good to be consistent
> across the whole kernel. Someone will eventually come by and fix it
> up anyways, as there have been a few of these patches already in the
> git history.
So there literally is a better encoding of this mnemonic which isn't
just a byte shorter, but is also faster to execute. And one *hopes*
that the compiler knows about it... yep... so why in $DEITY's name
can't I type what I mean into an asm file? Isn't asm intricate enough
already?
Meh, life's too short. Not shaving that particular yak today. I've put
the git tree back to using %edx, with a comment that it zero-extends.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature