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

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 7 23:36:16 PST 2022


pengfei added a comment.

> So xorl %ecx, %edx doesn't zero out all 64-bits of %rcx and %rdx? That's two 32-bit writes to two different registers, isn't it?

`xorl %ecx, %edx` only zero out bit 63:32 of `rdx`.

1. There's only 1 write to register in the instruction, i.e. `%edx`;
2. As a src, none bit of `%ecx` will be changed after the instruction;
3. `xorl` is not a zeroing instruction, bit 31:0 of `rdx` happens to zero only if `%ecx` == `%edx `;

So the values after the instuction are:

  RCX = RCX_old
  RDX[63:32] = 0
  RDX[31:0] = RCX_old[31:0] ^ RDX_old[31:0]


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