[clang] [llvm] [SPIRV] Add support for the `SPV_EXT_long_vector` extension (PR #210279)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 01:35:57 PDT 2026


================
@@ -1978,8 +2002,10 @@ SPIRVTypeInst SPIRVGlobalRegistry::getOrCreateSPIRVVectorType(
   MachineIRBuilder MIRBuilder(*DepMI->getParent(), DepMI->getIterator());
   const MachineInstr *NewMI = createConstOrTypeAtFunctionEntry(
       MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {
+        auto OpTy =
+            (isLongVector(Ty)) ? SPIRV::OpTypeVectorIdEXT : SPIRV::OpTypeVector;
----------------
jmmartinez wrote:

In `SPIRVGlobalRegistry::getOpTypeVectorImpl` we use `SPIRV::OpTypeVectorIdEXT` if the extension is available. In here we use the `N != 2 && N != 3 && N != 4 && N != 8 && N != 16` condition.

Can we always use `SPIRV::OpTypeVectorIdEXT` if the extension is available? Or, should we also take into account the number of elements of the vector in `SPIRVGlobalRegistry::getOpTypeVectorImpl`? I personally prefer the first alternative.

https://github.com/llvm/llvm-project/pull/210279


More information about the llvm-commits mailing list