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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to