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

Constable, Scott D via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 20 08:30:15 PST 2021


Hi Tim,

One of the first things I tried was to insert a zero extend 16-to-32-bit instruction, but that also caused an additional 32-bit physical register to be generated, which is not what I want.

The actual implementation I'm doing is a bit more complex than the example I provided for illustrative purposes. In my case, I don't need to care about the upper bits at all.

Thanks,

Scott

-----Original Message-----
From: Tim Northover <t.p.northover at gmail.com> 
Sent: Wednesday, January 20, 2021 8:08 AM
To: Constable, Scott D <scott.d.constable at intel.com>
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] [X86] Is it possible to implicitly promote a virtual subregister to a super?

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