[clang] [CIR][SPIR-V] Dispatch AMDGPU builtins on AMDGCN-flavored SPIR-V (PR #222018)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 01:25:21 PDT 2026


================
@@ -3361,6 +3364,13 @@ emitTargetArchBuiltinExpr(CIRGenFunction *cgf, unsigned builtinID,
   case llvm::Triple::riscv32:
   case llvm::Triple::riscv64:
     return cgf->emitRISCVBuiltinExpr(builtinID, e);
+  case llvm::Triple::spirv32:
+  case llvm::Triple::spirv64:
+    if (cgf->getTarget().getTriple().getOS() == llvm::Triple::OSType::AMDHSA)
+      return cgf->emitAMDGPUBuiltinExpr(builtinID, e);
+    [[fallthrough]];
----------------
steffenlarsen wrote:

Fallthrough just to avoid another `return std::nullopt` isn't worth it IMO.

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


More information about the cfe-commits mailing list