[clang] [llvm] [SPIRV] Add support for the `SPV_EXT_long_vector` extension (PR #210279)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 20 06:20:48 PDT 2026
================
@@ -1629,6 +1629,22 @@ void addInstrRequirements(const MachineInstr &MI,
}
break;
}
+ case SPIRV::OpTypeVectorIdEXT: {
+ if (!ST.canUseExtension(SPIRV::Extension::SPV_EXT_long_vector))
+ reportFatalUsageError("OpTypeVectorIdEXT requires the following SPIR-V "
+ "extension: SPV_EXT_long_vector extension");
+ Reqs.addExtension(SPIRV::Extension::SPV_EXT_long_vector);
+ Reqs.addCapability(SPIRV::Capability::LongVectorEXT);
+ assert(MI.getOperand(1).isReg());
+ const MachineRegisterInfo &MRI = MI.getMF()->getRegInfo();
+ SPIRVTypeInst ElemTypeDef = MRI.getVRegDef(MI.getOperand(1).getReg());
+ if (ElemTypeDef->getOpcode() == SPIRV::OpTypePointer &&
+ ST.canUseExtension(SPIRV::Extension::SPV_INTEL_masked_gather_scatter)) {
+ Reqs.addExtension(SPIRV::Extension::SPV_INTEL_masked_gather_scatter);
+ Reqs.addCapability(SPIRV::Capability::MaskedGatherScatterINTEL);
+ }
----------------
AlexVlx wrote:
Possibly, but there is appeal to keeping the cases separate for e.g. debugging / readability. One option would be to move the handling of pointer element types into a separate function, and call it here?
https://github.com/llvm/llvm-project/pull/210279
More information about the cfe-commits
mailing list