[llvm] [AMDGPU][Codegen] Legalize 16bit register class in sdag (PR #220275)

Guo Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 10:56:13 PDT 2026


broxigarchen wrote:

> This shouldn't really require post processing...

I don't know if there is a better way to do this. The sdag instr emitter will try to constrain the regclass on the def-use chain when emitting the register operand, and if it see a sreg32 used by a valu16 it will inserts a copy from sreg32 to vgpr16 by default.

I would imagine the cleanest way is to replace the sreg_32 from vs_16 class to sgpr_lo16, and remove 16bit types from sreg_32 legal type set in true16 mode, but it would requires a lot of infra change with little gain. 

https://github.com/llvm/llvm-project/pull/220275


More information about the llvm-commits mailing list