================ @@ -18528,37 +18520,38 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, Value *Op1 = EmitScalarExpr(E->getArg(1)); llvm::Type *T0 = Op0->getType(); llvm::Type *T1 = Op1->getType(); + + // If the arguments are scalars, just emit a multiply if (!T0->isVectorTy() && !T1->isVectorTy()) { if (T0->isFloatingPointTy()) - return Builder.CreateFMul(Op0, Op1, "dx.dot"); + return Builder.CreateFMul(Op0, Op1, "dot"); if (T0->isIntegerTy()) - return Builder.CreateMul(Op0, Op1, "dx.dot"); + return Builder.CreateMul(Op0, Op1, "dot"); - // Bools should have been promoted llvm_unreachable( "Scalar dot product is only supported on ints and floats."); } + // For vectors, validate types and emit the appropriate intrinsic + // A VectorSplat should have happened assert(T0->isVectorTy() && T1->isVectorTy() && "Dot product of vector and scalar is not supported."); - // A vector sext or sitofp should have happened - assert(T0->getScalarType() == T1->getScalarType() && - "Dot product of vectors need the same element types."); - auto *VecTy0 = E->getArg(0)->getType()->getAs<VectorType>(); [[maybe_unused]] auto *VecTy1 = E->getArg(1)->getType()->getAs<VectorType>(); - // A HLSLVectorTruncation should have happend + + assert(VecTy0->getElementType() == VecTy1->getElementType() && ---------------- pow2clk wrote:
Switched to clang types to match signedness of integers https://github.com/llvm/llvm-project/pull/102872 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits