@@ -1413,9 +1413,12 @@ LLVMToSPIRVBase::getLoopControl(const BranchInst *Branch,
14131413 // PartialCount must not be used with the DontUnroll bit
14141414 else if (S == " llvm.loop.unroll.count" &&
14151415 !(LoopControl & LoopControlDontUnrollMask)) {
1416- size_t I = getMDOperandAsInt (Node, 1 );
1417- ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1418- LoopControl |= spv::LoopControlPartialCountMask;
1416+ if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
1417+ BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
1418+ size_t I = getMDOperandAsInt (Node, 1 );
1419+ ParametersToSort.emplace_back (spv::LoopControlPartialCountMask, I);
1420+ LoopControl |= spv::LoopControlPartialCountMask;
1421+ }
14191422 } else if (S == " llvm.loop.ivdep.enable" )
14201423 LoopControl |= spv::LoopControlDependencyInfiniteMask;
14211424 else if (S == " llvm.loop.ivdep.safelen" ) {
@@ -2476,10 +2479,10 @@ bool LLVMToSPIRVBase::transDecoration(Value *V, SPIRVValue *BV) {
24762479
24772480 if (auto BVO = dyn_cast_or_null<OverflowingBinaryOperator>(V)) {
24782481 if (BVO->hasNoSignedWrap ()) {
2479- BV->setNoSignedWrap (true );
2482+ BV->setNoIntegerDecorationWrap <DecorationNoSignedWrap> (true );
24802483 }
24812484 if (BVO->hasNoUnsignedWrap ()) {
2482- BV->setNoUnsignedWrap (true );
2485+ BV->setNoIntegerDecorationWrap <DecorationNoUnsignedWrap> (true );
24832486 }
24842487 }
24852488
@@ -4605,43 +4608,34 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46054608 }
46064609 } break ;
46074610 case spv::ExecutionModeNoGlobalOffsetINTEL: {
4608- if (BM->isAllowedToUseExtension (
4609- ExtensionID::SPV_INTEL_kernel_attributes)) {
4610- BF-> addExecutionMode (BM-> add (
4611- new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))));
4612- BM-> addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4613- BM->addCapability (CapabilityKernelAttributesINTEL );
4614- }
4611+ if (! BM->isAllowedToUseExtension (
4612+ ExtensionID::SPV_INTEL_kernel_attributes))
4613+ break ;
4614+ BF-> addExecutionMode (BM-> add (
4615+ new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode))) );
4616+ BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes );
4617+ BM-> addCapability (CapabilityKernelAttributesINTEL);
46154618 } break ;
46164619 case spv::ExecutionModeVecTypeHint:
46174620 case spv::ExecutionModeSubgroupSize:
4618- case spv::ExecutionModeSubgroupsPerWorkgroup: {
4619- unsigned X;
4620- N.get (X);
4621- BF->addExecutionMode (BM->add (
4622- new SPIRVExecutionMode (BF, static_cast <ExecutionMode>(EMode), X)));
4623- } break ;
4621+ case spv::ExecutionModeSubgroupsPerWorkgroup:
4622+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4623+ break ;
46244624 case spv::ExecutionModeNumSIMDWorkitemsINTEL:
46254625 case spv::ExecutionModeSchedulerTargetFmaxMhzINTEL:
46264626 case spv::ExecutionModeMaxWorkDimINTEL:
46274627 case spv::internal::ExecutionModeStreamingInterfaceINTEL: {
4628- if (BM->isAllowedToUseExtension (
4629- ExtensionID::SPV_INTEL_kernel_attributes)) {
4630- unsigned X;
4631- N.get (X);
4632- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4633- BF, static_cast <ExecutionMode>(EMode), X)));
4634- BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4635- BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
4636- }
4628+ if (!BM->isAllowedToUseExtension (
4629+ ExtensionID::SPV_INTEL_kernel_attributes))
4630+ break ;
4631+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4632+ BM->addExtension (ExtensionID::SPV_INTEL_kernel_attributes);
4633+ BM->addCapability (CapabilityFPGAKernelAttributesINTEL);
46374634 } break ;
46384635 case spv::ExecutionModeSharedLocalMemorySizeINTEL: {
46394636 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
46404637 break ;
4641- unsigned SLMSize;
4642- N.get (SLMSize);
4643- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4644- BF, static_cast <ExecutionMode>(EMode), SLMSize)));
4638+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
46454639 } break ;
46464640 case spv::ExecutionModeNamedBarrierCountINTEL: {
46474641 if (!BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_vector_compute))
@@ -4659,12 +4653,14 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46594653 case spv::ExecutionModeSignedZeroInfNanPreserve:
46604654 case spv::ExecutionModeRoundingModeRTE:
46614655 case spv::ExecutionModeRoundingModeRTZ: {
4662- if (!BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_float_controls))
4663- break ;
4664- unsigned TargetWidth;
4665- N.get (TargetWidth);
4666- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4667- BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
4656+ if (BM->isAllowedToUseVersion (VersionNumber::SPIRV_1_4)) {
4657+ BM->setMinSPIRVVersion (VersionNumber::SPIRV_1_4);
4658+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4659+ } else if (BM->isAllowedToUseExtension (
4660+ ExtensionID::SPV_KHR_float_controls)) {
4661+ BM->addExtension (ExtensionID::SPV_KHR_float_controls);
4662+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
4663+ }
46684664 } break ;
46694665 case spv::ExecutionModeRoundingModeRTPINTEL:
46704666 case spv::ExecutionModeRoundingModeRTNINTEL:
@@ -4673,10 +4669,7 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46734669 if (!BM->isAllowedToUseExtension (
46744670 ExtensionID::SPV_INTEL_float_controls2))
46754671 break ;
4676- unsigned TargetWidth;
4677- N.get (TargetWidth);
4678- BF->addExecutionMode (BM->add (new SPIRVExecutionMode (
4679- BF, static_cast <ExecutionMode>(EMode), TargetWidth)));
4672+ AddSingleArgExecutionMode (static_cast <ExecutionMode>(EMode));
46804673 } break ;
46814674 case spv::internal::ExecutionModeFastCompositeKernelINTEL: {
46824675 if (BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_fast_composite))
0 commit comments