Messages in this thread | | | Date | Mon, 8 Aug 2022 11:59:17 -0700 | From | "H. Peter Anvin" <> | Subject | Re: [PATCH 1/1] x86: Change mov $0, %reg with xor %reg, %reg |
| |
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.
| |