@@ -1418,9 +1418,12 @@ LLVMToSPIRVBase::getLoopControl(const BranchInst *Branch,
14181418 // PartialCount must not be used with the DontUnroll bit
14191419 else if (S == " llvm.loop.unroll.count" &&
14201420 !(LoopControl & LoopControlDontUnrollMask)) {
1421- size_t I = getMDOperandAsInt (Node, 1 );
1422- ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1423- LoopControl |= spv::LoopControlPartialCountMask;
1421+ if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
1422+ BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
1423+ size_t I = getMDOperandAsInt (Node, 1 );
1424+ ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1425+ LoopControl |= spv::LoopControlPartialCountMask;
1426+ }
14241427 } else if (S == " llvm.loop.ivdep.enable" )
14251428 LoopControl |= spv::LoopControlDependencyInfiniteMask;
14261429 else if (S == " llvm.loop.ivdep.safelen" ) {
@@ -2481,10 +2484,10 @@ bool LLVMToSPIRVBase::transDecoration(Value *V, SPIRVValue *BV) {
24812484
24822485 if (auto BVO = dyn_cast_or_null<OverflowingBinaryOperator>(V)) {
24832486 if (BVO->hasNoSignedWrap ()) {
2484- BV->setNoSignedWrap (true );
2487+ BV->setNoIntegerDecorationWrap <DecorationNoSignedWrap> (true );
24852488 }
24862489 if (BVO->hasNoUnsignedWrap ()) {
2487- BV->setNoUnsignedWrap (true );
2490+ BV->setNoIntegerDecorationWrap <DecorationNoUnsignedWrap> (true );
24882491 }
24892492 }
24902493
@@ -4610,43 +4613,34 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46104613 }
46114614 } break ;
46124615 case spv::ExecutionModeNoGlobalOffsetINTEL: {
4613- if (BM->isAllowedToUseExtension (
4614- ExtensionID::SPV_INTEL_kernel_attributes)) {
4615- BF-> addExecutionMode (BM-> add (
4616- new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))));
4617- BM-> addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4618- BM->addCapability (CapabilityKernelAttributesINTEL );
4619- }
4616+ if (! BM->isAllowedToUseExtension (
4617+ ExtensionID::SPV_INTEL_kernel_attributes))
4618+ break ;
4619+ BF-> addExecutionMode (BM-> add (
4620+ new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))) );
4621+ BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4622+ BM-> addCapability (CapabilityKernelAttributesINTEL);
46204623 } break ;
46214624 case spv::ExecutionModeVecTypeHint:
46224625 case spv::ExecutionModeSubgroupSize:
4623- case spv::ExecutionModeSubgroupsPerWorkgroup: {
4624- unsigned X;
4625- N.get (X);
4626- BF->addExecutionMode (BM->add (
4627- new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode), X)));
4628- } break ;
4626+ case spv::ExecutionModeSubgroupsPerWorkgroup:
4627+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4628+ break ;
46294629 case spv::ExecutionModeNumSIMDWorkitemsINTEL:
46304630 case spv::ExecutionModeSchedulerTargetFmaxMhzINTEL:
46314631 case spv::ExecutionModeMaxWorkDimINTEL:
46324632 case spv::internal::ExecutionModeStreamingInterfaceINTEL: {
4633- if (BM->isAllowedToUseExtension (
4634- ExtensionID::SPV_INTEL_kernel_attributes)) {
4635- unsigned X;
4636- N.get (X);
4637- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4638- BF, static_cast <ExecutionMode>(EMode), X)));
4639- BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4640- BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
4641- }
4633+ if (!BM->isAllowedToUseExtension (
4634+ ExtensionID::SPV_INTEL_kernel_attributes))
4635+ break ;
4636+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4637+ BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4638+ BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
46424639 } break ;
46434640 case spv::ExecutionModeSharedLocalMemorySizeINTEL: {
46444641 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
46454642 break ;
4646- unsigned SLMSize;
4647- N.get (SLMSize);
4648- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4649- BF, static_cast <ExecutionMode>(EMode), SLMSize)));
4643+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
46504644 } break ;
46514645 case spv::ExecutionModeNamedBarrierCountINTEL: {
46524646 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
@@ -4664,12 +4658,14 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46644658 case spv::ExecutionModeSignedZeroInfNanPreserve:
46654659 case spv::ExecutionModeRoundingModeRTE:
46664660 case spv::ExecutionModeRoundingModeRTZ: {
4667- if (!BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_float_controls))
4668- break ;
4669- unsigned TargetWidth;
4670- N.get (TargetWidth);
4671- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4672- BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
4661+ if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
4662+ BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
4663+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4664+ } else if (BM->isAllowedToUseExtension (
4665+ ExtensionID::SPV_KHR_float_controls)) {
4666+ BM->addExtension (ExtensionID::SPV_KHR_float_controls);
4667+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4668+ }
46734669 } break ;
46744670 case spv::ExecutionModeRoundingModeRTPINTEL:
46754671 case spv::ExecutionModeRoundingModeRTNINTEL:
@@ -4678,10 +4674,7 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46784674 if (!BM->isAllowedToUseExtension (
46794675 ExtensionID::SPV_INTEL_float_controls2))
46804676 break ;
4681- unsigned TargetWidth;
4682- N.get (TargetWidth);
4683- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4684- BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
4677+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
46854678 } break ;
46864679 case spv::internal::ExecutionModeFastCompositeKernelINTEL: {
46874680 if (BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_fast_composite))
0 commit comments