[clang] [llvm] [HLSL] Add wave prefix count bits function (PR #178059)

Tex Riddell via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 28 10:02:40 PST 2026


================
@@ -3607,6 +3607,30 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_wave_prefix_count_bits: {
+    if (SemaRef.checkArgCount(TheCall, 1))
+      return true;
+
+    // Ensure input expr type is a scalar/vector and then
+    // set the return type to the arg type
----------------
tex3d wrote:

This comment doesn't sound right, nor is it what the code does.
- doesn't accept vector input (WavePrefixCountBits is scalar only in DXC too, so it's a comment problem)
- Does not set the return type (which is fine if it's already uint in definition)
- The return type should not be the same as the arg type - should be uint

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


More information about the cfe-commits mailing list