From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Jan Beulich <JBeulich@suse.com>
Cc: mingo@elte.hu, rdunlap@infradead.org, tglx@linutronix.de,
hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86-64: use 32-bit XOR to zero registers
Date: Tue, 26 Jun 2018 08:38:22 -0300 [thread overview]
Message-ID: <20180626113822.ch3erlyud5wsxvvg@khazad-dum.debian.net> (raw)
In-Reply-To: <5B31DDFF02000078001CDC03@prv1-mh.provo.novell.com>
On Tue, 26 Jun 2018, Jan Beulich wrote:
> >>> On 25.06.18 at 18:33, <rdunlap@infradead.org> wrote:
> > On 06/25/2018 03:25 AM, Jan Beulich wrote:
> >> Some Intel CPUs don't recognize 64-bit XORs as zeroing idioms - use
> >> 32-bit ones instead.
> >
> > Hmph. Is that considered a bug (errata)?
>
> No.
>
> > URL/references?
>
> Intel's Optimization Reference Manual says so (in rev 040 this is in section
> 16.2.2.5 "Zeroing Idioms" as a subsection of the Goldmont/Silvermont
> descriptions).
>
> > Are these changes really only zeroing the lower 32 bits of the register?
> > and that's all that the code cares about?
>
> No - like all operations targeting a 32-bit register, the result is zero
> extended to the entire 64-bit destination register.
Missing information that would have been helpful in the commit message:
When the processor can recognize something as a zeroing idiom, it
optimizes that operation on the front-end. Only 32-bit XOR r,r is
documented as a zeroing idiom according to the Intel optimization
manual. While a few Intel processors recognize the 64-bit version of
XOR r,r as a zeroing idiom, many won't.
Note that the 32-bit operation extends to the high part of the 64-bit
register, so it will zero the entire 64-bit register. The 32-bit
instruction is also one byte shorter.
The last sentence is just a reminder, for completeness...
--
Henrique Holschuh
next prev parent reply other threads:[~2018-06-26 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 10:25 [PATCH] x86-64: use 32-bit XOR to zero registers Jan Beulich
2018-06-25 16:33 ` Randy Dunlap
2018-06-25 16:49 ` hpa
2018-06-26 6:32 ` Jan Beulich
2018-06-26 11:38 ` Henrique de Moraes Holschuh [this message]
2018-07-26 9:19 ` Pavel Machek
2018-07-26 11:45 ` Ingo Molnar
2018-07-26 18:17 ` Pavel Machek
2018-07-26 19:06 ` Ingo Molnar
2018-06-26 7:17 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180626113822.ch3erlyud5wsxvvg@khazad-dum.debian.net \
--to=hmh@hmh.eng.br \
--cc=JBeulich@suse.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).