[PATCH] D110869: [X86] Implement -fzero-call-used-regs option

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 3 23:05:52 PST 2022


void added a comment.

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.

> Definitely something magical about this function. Perhaps it should have the function attribute to disable zeroing added to the kernel sources?
>
> tools/objtool/objtool.c mentions something about `_paravirt_ident_64` and `paravirt_patch`.
>
> I'm curious @nathanchance if you move the definition of `_paravirt_ident_64` to an external assembler file, and see whether the mere `xorl` vs `xorq` makes a difference for some reason for boot?




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