[llvm] [SPIR-V] Add support for SPV_INTEL_masked_gather_scatter extension (PR #185418)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 01:58:34 PDT 2026


================
@@ -4321,6 +4377,16 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
     return selectDerivativeInst(ResVReg, ResType, I, SPIRV::OpDPdyFine);
   case Intrinsic::spv_fwidth:
     return selectDerivativeInst(ResVReg, ResType, I, SPIRV::OpFwidth);
+  case Intrinsic::spv_masked_gather:
+    if (STI.canUseExtension(SPIRV::Extension::SPV_INTEL_masked_gather_scatter))
+      return selectMaskedGather(ResVReg, ResType, I);
+    report_fatal_error(
+        "llvm.masked.gather requires SPV_INTEL_masked_gather_scatter");
----------------
jmmartinez wrote:

Instead of `report_fatal_error`, this should be a call to `diagnose`.

Something like:

```cpp
Function &F = I.getMF()->getFunction();
F.getContext().diagnose(DiagnosticInfoUnsupported(F, "llvm.masked.gather requires SPV_INTEL_masked_gather_scatter", I.getDebugLoc(), DS_Error);
return false;
```

Notice that the call to diagnose returns so we should stop instruction selection by returning false.

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


More information about the llvm-commits mailing list