[clang] [llvm] [HLSL][DXIL][SPIRV] Create llvm dot intrinsic and use for HLSL (PR #102872)

Greg Roth via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 03:20:43 PDT 2024


================
@@ -380,6 +383,20 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg,
       MIB.addImm(V);
     return MIB.constrainAllUses(TII, TRI, RBI);
   }
+
+  case TargetOpcode::G_FDOTPROD: {
+    MachineBasicBlock &BB = *I.getParent();
+    return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpDot))
+        .addDef(ResVReg)
+        .addUse(GR.getSPIRVTypeID(ResType))
+        .addUse(I.getOperand(1).getReg())
+        .addUse(I.getOperand(2).getReg())
+        .constrainAllUses(TII, TRI, RBI);
+  }
----------------
pow2clk wrote:

There is a similar implementation here: https://github.com/llvm/llvm-project/blob/a0241e710fcae9f439e57d3a294b1ace97c6906c/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp#L1524 , but I'm not sure if they are mergeable and this is what was discussed.

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


More information about the cfe-commits mailing list