[PATCH] D110869: [X86] Implement -fzero-call-used-regs option
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 3 23:16:01 PST 2022
craig.topper added a comment.
In D110869#3295906 <https://reviews.llvm.org/D110869#3295906>, @void wrote:
> In D110869#3295578 <https://reviews.llvm.org/D110869#3295578>, @nickdesaulniers wrote:
>
>> In D110869#3295559 <https://reviews.llvm.org/D110869#3295559>, @void wrote:
>>
>>> Weird. We generate similar code to GCC:
>>>
>>> Clang:
>>> _paravirt_ident_64: # @_paravirt_ident_64
>>> movq %rdi, %rax
>>> xorq %rdi, %rdi
>>> retq
>>>
>>> GCC:
>>> _paravirt_ident_64:
>>> movq %rdi, %rax # tmp85, x
>>> xorl %edi, %edi #
>>> ret
>>
>> Does `xorl` not zero the upper 32b?
>
> I'm thinking no. But it's odd, because both are using `%rdi` but GCC is only zeroing out the bottom 32-bits. Seems a bit counter-intuitive.
Every write to a 32-bit register on x86-64 zeros bits 63:32 of the register. `xorl %edi, %edi` has the same behavior as `xorq %rdi, %rdi`, but is 1 byte shorter to encode.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110869/new/
https://reviews.llvm.org/D110869
More information about the cfe-commits
mailing list