@@ -4446,5 +4446,60 @@ class SPIRVSubgroupMatrixMultiplyAccumulateINTELInst
44464446_SPIRV_OP (SubgroupMatrixMultiplyAccumulate, true , 7 , true , 4 )
44474447#undef _SPIRV_OP
44484448
4449+ class SPIRVTernaryBitwiseFunctionINTELInst : public SPIRVInstTemplateBase {
4450+ public:
4451+ void validate () const override {
4452+ SPIRVInstruction::validate ();
4453+ SPIRVErrorLog &SPVErrLog = this ->getModule ()->getErrorLog ();
4454+ std::string InstName = " BitwiseFunctionINTEL" ;
4455+
4456+ const SPIRVType *ResTy = this ->getType ();
4457+ SPVErrLog.checkError (
4458+ ResTy->isTypeInt () || (ResTy->isTypeVector () &&
4459+ ResTy->getVectorComponentType ()->isTypeInt ()),
4460+ SPIRVEC_InvalidInstruction,
4461+ InstName + " \n Result type must be an integer scalar or vector.\n " );
4462+
4463+ auto CommonArgCheck = [this , ResTy, &InstName,
4464+ &SPVErrLog](size_t ArgI, const char *ArgPlacement) {
4465+ SPIRVValue *Arg =
4466+ const_cast <SPIRVTernaryBitwiseFunctionINTELInst *>(this )->getOperand (
4467+ ArgI);
4468+ SPVErrLog.checkError (
4469+ Arg->getType () == ResTy, SPIRVEC_InvalidInstruction,
4470+ InstName + " \n " + ArgPlacement +
4471+ " argument must be the same as the result type.\n " );
4472+ };
4473+
4474+ CommonArgCheck (0 , " First" );
4475+ CommonArgCheck (1 , " Second" );
4476+ CommonArgCheck (2 , " Third" );
4477+
4478+ SPIRVValue *LUTIndexArg =
4479+ const_cast <SPIRVTernaryBitwiseFunctionINTELInst *>(this )->getOperand (3 );
4480+ const SPIRVType *LUTIndexArgTy = LUTIndexArg->getType ();
4481+ SPVErrLog.checkError (
4482+ LUTIndexArgTy->isTypeInt (32 ), SPIRVEC_InvalidInstruction,
4483+ InstName + " \n Fourth argument must be a 32-bit integer scalar.\n " );
4484+ SPVErrLog.checkError (
4485+ isConstantOpCode (LUTIndexArg->getOpCode ()), SPIRVEC_InvalidInstruction,
4486+ InstName + " \n Fourth argument must be constant instruction.\n " );
4487+ }
4488+
4489+ std::optional<ExtensionID> getRequiredExtension () const override {
4490+ return ExtensionID::SPV_INTEL_ternary_bitwise_function;
4491+ }
4492+ SPIRVCapVec getRequiredCapability () const override {
4493+ return getVec (internal::CapabilityTernaryBitwiseFunctionINTEL);
4494+ }
4495+ };
4496+
4497+ #define _SPIRV_OP (x, ...) \
4498+ typedef SPIRVInstTemplate<SPIRVTernaryBitwiseFunctionINTELInst, \
4499+ internal::Op##x##INTEL, __VA_ARGS__> \
4500+ SPIRV##x##INTEL;
4501+ _SPIRV_OP (BitwiseFunction, true , 7 )
4502+ #undef _SPIRV_OP
4503+
44494504} // namespace SPIRV
44504505#endif // SPIRV_LIBSPIRV_SPIRVINSTRUCTION_H
0 commit comments