[llvm] [AMDGPU][True16][CodeGen] stop emitting spgr_lo16 from isel (PR #144819)
Brox Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 07:13:58 PDT 2025
broxigarchen wrote:
> > > > Why is legalizeOperandsVALUt16 called separately from legalizeOperands? It seems like something that should just be a part of legalizeOperands.
> > >
> > >
> > > We used to do that in legalizeOperands, but had a discussion with Matt and it seems the legalizeOperand is a hack for constant bus restriction (see https://github.com/llvm/llvm-project/pull/131859/files#r2002366361)
> >
> >
> > My point was more that legalizeOperandsVALUt16 shouldn't really exist. legalizeOperands is solving an additional context problem that requires knowledge of all the operands of the instruction not available at selection time. legalizeOperandsVALUt16 seems to be fixing up single operand constraints that should have been emitted as correct in the first place.
>
> IIUC they were emitted as correct in the first place but got broken by the way moveToVALU replaces 32-bit SGPRs with 32-bit VGPRs for 16-bit operands. legalizeOperandsVALUt16 is just a centralised place to fix that specific breakage.
Hi Matt and Jay, yes these are emitted correctly, but need special fix during moveToVALU lowering (see https://github.com/llvm/llvm-project/pull/145450#issuecomment-3004799650). We have this problem mainly because we don't have spgr16 support.
For the legalizeOperandsVALUt16 and the legalizeOperands call, I am ok with either splitting them, or creating a helper to put them together. What do you think?
https://github.com/llvm/llvm-project/pull/144819
More information about the llvm-commits
mailing list