[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a0def3d-f8cf-5ee4-62c7-be61c4022401@zytor.com>
Date: Thu, 27 Aug 2020 10:23:14 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Uros Bizjak <ubizjak@...il.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH] x86: Use XORL r32,r32 in __get_user_asm
On 2020-08-27 09:49, Uros Bizjak wrote:
> Use XORL r32,r32 for all operand sizes. x86_64 zero extends 32bit
> operations, so for 64bit operands, XORL r32,r32 is functionally
> equal to XORL r64,r64, but avoids a REX prefix byte when legacy
> registers are used.
Please make it clear that this refers specifically to the use case of both
registers being the same, for zeroing. This could otherwise be misread.
"xorl r64,r64" is nonsensical: you're referring to xorq.
The apparent visual mix here between Intel and gas syntax is also confusing.
I would explicily say, using gcc inline syntax:
xorl %0,%0 is equivalent to xorq %0,%0 as both will zero the entire register.
> 32bit operation also avoids 0x66 size prefix for 16bit operands
> and REX prefix when %sil, %dil and %bpl 8bit registers are used.
>
> As a bonus, 32bit XORL breaks register dependency chains, avoiding
> potential partial register stalls with 8 and 16bit operands.
Please make it clear that zeroing the full register is OK in this use case
(which it is.)
> The patch lowers the size of .fixup section by 20 bytes.
-hpa
Powered by blists - more mailing lists