[llvm-dev] [X86] Is it possible to implicitly promote a virtual subregister to a super?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 20 08:08:03 PST 2021


On Wed, 20 Jan 2021 at 15:53, Constable, Scott D via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> The above will not pass with --verify-machineinstrs and the CMP32rr will print to something like:
>
> cmpl %ax, %ebx
>
> Is it possible to implicitly “promote” (for lack of a better word) the 16-bit GPR into its 32-bit super?

Not implicitly, you need another vreg with class GR32 and some
operation to widen the narrow one. And actually you probably need that
to be a real sign/zero extension or something because I don't think
x86 clears the high bits of eax when writing to ax, does it?

If it was 32 -> 64 bit, I think the rules are different and rax would
be zero-extended automatically. In that case you could use a
SUBREG_TO_REG which would eventually go away.

Cheers.

Tim.


More information about the llvm-dev mailing list