[PATCH] D126857: [HLSL] Add WaveActiveCountBits as Langugage builtin function for HLSL

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 13:06:13 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
python3kgae marked an inline comment as done.
Closed by commit rG6bea9ff91378: [HLSL] Add WaveActiveCountBits as Langugage builtin function for HLSL (authored by python3kgae).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126857/new/

https://reviews.llvm.org/D126857

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/Builtins.h
  clang/test/SemaHLSL/Wave.hlsl


Index: clang/test/SemaHLSL/Wave.hlsl
===================================================================
--- /dev/null
+++ clang/test/SemaHLSL/Wave.hlsl
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1  -x hlsl -triple dxil--shadermodel6.7-library  %s  -verify
+
+// Make sure WaveActiveCountBits is accepted.
+
+// expected-no-diagnostics
+unsigned foo(bool b) {
+    return WaveActiveCountBits(b);
+}
Index: clang/include/clang/Basic/Builtins.h
===================================================================
--- clang/include/clang/Basic/Builtins.h
+++ clang/include/clang/Basic/Builtins.h
@@ -42,6 +42,7 @@
   OCL_PIPE = 0x200,          // builtin requires OpenCL pipe.
   OCL_DSE = 0x400,           // builtin requires OpenCL device side enqueue.
   ALL_OCL_LANGUAGES = 0x800, // builtin for OCL languages.
+  HLSL_LANG = 0x1000,        // builtin requires HLSL.
   ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
   ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG,  // builtin requires GNU mode.
   ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG     // builtin requires MS mode.
Index: clang/include/clang/Basic/Builtins.def
===================================================================
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -1693,6 +1693,9 @@
 // CUDA/HIP
 LANGBUILTIN(__builtin_get_device_side_mangled_name, "cC*.", "ncT", CUDA_LANG)
 
+// HLSL
+LANGBUILTIN(WaveActiveCountBits, "Uib", "nc", HLSL_LANG)
+
 // Builtins for XRay
 BUILTIN(__xray_customevent, "vcC*z", "")
 BUILTIN(__xray_typedevent, "vzcC*z", "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126857.433855.patch
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220602/fe4075ff/attachment.bin>


More information about the cfe-commits mailing list