[clang] [llvm] [HLSL] Add QuadAll Emulation support (PR #240645)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 00:18:58 PST 2026


================
@@ -3226,11 +3227,31 @@ class DiagnoseHLSLAvailability : public DynamicRecursiveASTVisitor {
   }
 
   bool VisitCallExpr(CallExpr *CE) override {
+    DiagnoseQuadAllCall(CE);
     DiagnoseBarrierCall(CE);
     return true;
   }
 };
 
+void DiagnoseHLSLAvailability::DiagnoseQuadAllCall(CallExpr *CE) {
+  const FunctionDecl *FD = CE->getDirectCallee();
+  if (!FD || FD->getBuiltinID() != Builtin::BI__builtin_hlsl_quad_all)
+    return;
+
+  switch (GetCurrentShaderEnvironment()) {
+  case llvm::Triple::UnknownEnvironment:
+  case llvm::Triple::Pixel:
+  case llvm::Triple::Compute:
+  case llvm::Triple::Mesh:
+  case llvm::Triple::Amplification:
+    return;
+  default:
+    SemaRef.Diag(CE->getExprLoc(), diag::err_hlsl_builtin_unsupported_in_stage)
+        << FD
+        << llvm::Triple::getEnvironmentTypeName(GetCurrentShaderEnvironment());
+  }
+}
+
----------------
hekota wrote:

That means this Sema diagnostic code should not be included as part of this PR, right? 

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


More information about the cfe-commits mailing list