[llvm] [AMDGPU] Src1 of VOP3 DPP instructions can be SGPR on supported subtargets (PR #67461)

Joe Nash via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 11:02:39 PDT 2023


================
@@ -301,7 +302,14 @@ MachineInstr *GCNDPPCombine::createDPPInst(MachineInstr &OrigMI,
     }
     auto *Src1 = TII->getNamedOperand(OrigMI, AMDGPU::OpName::src1);
     if (Src1) {
-      if (!TII->isOperandLegal(*DPPInst.getInstr(), NumOperands, Src1)) {
+      int OpNum = NumOperands;
+      // If subtarget does not support SGPRs for src1 operand then the
+      // requirements are the same as for src0. We check src0 instead because
+      // pseudos are shared between subtargets and allow SGPR for src1 on all.
----------------
Sisyph wrote:

I think it is true for all current instructions that src0 and src1 should accept the same types in a VGPR. But can you please add some asserts to catch if it doesn't? You could check the size and float/not float matches.

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


More information about the llvm-commits mailing list