================ @@ -1446,6 +1452,90 @@ bool SPIRVInstructionSelector::selectRsqrt(Register ResVReg, .constrainAllUses(TII, TRI, RBI); } +// Select the OpDot instruction for the given float dot +bool SPIRVInstructionSelector::selectFloatDot(Register ResVReg, + const SPIRVType *ResType, + MachineInstr &I) const { + assert(I.getNumOperands() == 4); + assert(I.getOperand(2).isReg()); + assert(I.getOperand(3).isReg()); + + [[maybe_unused]] SPIRVType *VecType = + GR.getSPIRVTypeForVReg(I.getOperand(2).getReg()); + + assert(GR.getScalarOrVectorComponentCount(VecType) > 1 && + "dot product requires a vector of at least 2 components"); + ---------------- farzonl wrote:
should we also add an assert to make sure its a float vector? I know we have guarantees about that via `Intrinsic::spv_fdot` but I was concerned about misuse of the `selectFloatDot` function if say someone else wants to come along and use it for opencl? Its a nit pick so feel free to ignore. https://github.com/llvm/llvm-project/pull/104656 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits