[clang] [llvm] [HLSL][DirectX] Implement HLSL `mul` function and DXIL lowering of `llvm.matrix.multiply` (PR #184882)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 10:11:31 PST 2026


================
@@ -1054,6 +1055,40 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
     Value *Mul = Builder.CreateNUWMul(M, A);
     return Builder.CreateNUWAdd(Mul, B);
   }
+  case Builtin::BI__builtin_hlsl_mul: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    Value *Op1 = EmitScalarExpr(E->getArg(1));
+    QualType QTy0 = E->getArg(0)->getType();
+    QualType QTy1 = E->getArg(1)->getType();
+
+    bool IsVec0 = QTy0->isVectorType();
+    bool IsMat0 = QTy0->isConstantMatrixType();
+    bool IsMat1 = QTy1->isConstantMatrixType();
+
+    // Only matrix-involved cases reach the builtin (cases 6, 8, 9).
----------------
s-perron wrote:

I think the numbers in the comment come out of nowhere if I don't know where all of the cases are listed.

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


More information about the llvm-commits mailing list