[clang] [llvm] [HLSL][DXIL][SPIRV] Added WaveActiveBitOr HLSL intrinsic (PR #165156)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 11:20:55 PDT 2025


================
@@ -3211,6 +3211,29 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
     TheCall->setType(ArgTyExpr);
     break;
   }
+  case Builtin::BI__builtin_hlsl_wave_active_bit_or: {
+    if (SemaRef.checkArgCount(TheCall, 1))
+      return true;
+
+    // Ensure input expr type is a scalar/vector and the same as the return type
+    if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
+      return true;
+    if (CheckWaveActive(&SemaRef, TheCall))
+      return true;
+
+    // Ensure expression parameter type can be interpreted as a uint
+    ExprResult Expr = TheCall->getArg(0);
+    QualType ArgTyExpr = Expr.get()->getType();
+    if (!ArgTyExpr->isIntegerType()) {
+      SemaRef.Diag(TheCall->getArg(0)->getBeginLoc(),
+                   diag::err_typecheck_convert_incompatible)
+          << ArgTyExpr << SemaRef.Context.UnsignedIntTy << 1 << 0 << 0;
----------------
farzonl wrote:

What is unique about `BI__builtin_hlsl_wave_active_bit_or` that you need `err_typecheck_convert_incompatible` when `BI__builtin_hlsl_wave_active_max` does not do this? 

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


More information about the cfe-commits mailing list