linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kanna Scarlet <knscarlet@gnuweeb.org>, Joerg Roedel <jroedel@suse.de>
Cc: David Laight <David.Laight@aculab.com>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Bill Metzenthen <billm@melbpc.org.au>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Michael Roth <michael.roth@amd.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Sean Christopherson <seanjc@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ammar Faizi <ammarfaizi2@gnuweeb.org>,
	GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] x86: Change mov $0, %reg with xor %reg, %reg
Date: Mon, 8 Aug 2022 11:59:17 -0700	[thread overview]
Message-ID: <ad5f732f-778f-a337-38e5-0129d2f49793@zytor.com> (raw)
In-Reply-To: <4764d363-b5a4-0cf5-6ed0-0911c4182b5b@gnuweeb.org>

On August 8, 2022 9:45:45 AM PDT, Kanna Scarlet <knscarlet@gnuweeb.org> 
wrote:
>On 8/5/22 4:42 PM, Joerg Roedel wrote:
>> On Fri, Aug 05, 2022 at 09:26:02AM +0000, David Laight wrote:
>>> Use "xor %rax,%rax" instead of "xor %eax,%eax" to save
>>> the 'reg' prefix.
>> 
>> Also, some places explicitly use the mov variant to zero a register
>> without touching rflags. Please be careful to not change those.
>
>thank you for reminder, i will check again to make myself more sure
>the patch doesn't break this %rflags dependency situation
>
>Regards,

In some cases you can hoist the zeroing to avoid that (and sometimes 
improve performance in the process), but be very careful in general when 
messing with hand-optimized assembly code like crypto; for those pieces 
of code benchmarking the change is mandatory.

  reply	other threads:[~2022-08-08 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 15:26 [PATCH 0/1] x86 change mov 0, %reg to xor %reg, %reg Kanna Scarlet
2022-08-04 15:26 ` [PATCH 1/1] x86: Change mov $0, %reg with " Kanna Scarlet
2022-08-04 15:53   ` Borislav Petkov
2022-08-04 18:08     ` Kanna Scarlet
2022-08-05  9:26       ` David Laight
2022-08-05  9:42         ` Joerg Roedel
2022-08-08 16:45           ` Kanna Scarlet
2022-08-08 18:59             ` H. Peter Anvin [this message]
2022-08-08 16:38         ` Kanna Scarlet
2022-08-08 18:59         ` H. Peter Anvin
2022-08-09  7:38           ` David Laight
2022-08-05  9:54       ` Borislav Petkov
2022-08-08 16:57         ` Kanna Scarlet

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=ad5f732f-778f-a337-38e5-0129d2f49793@zytor.com \
    --to=hpa@zytor.com \
    --cc=David.Laight@aculab.com \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=ardb@kernel.org \
    --cc=billm@melbpc.org.au \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gwml@vger.gnuweeb.org \
    --cc=jpoimboe@kernel.org \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=knscarlet@gnuweeb.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).