[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 12:10:16 PDT 2022
python3kgae updated this revision to Diff 433835.
python3kgae marked 2 inline comments as done.
python3kgae added a comment.
Change to verify test.
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 -ast-dump -o - -finclude-default-header -verify
+
+// Make sure WaveActiveCountBits is accepted.
+
+// expected-no-diagnostics
+uint 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.433835.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220602/33aa062a/attachment.bin>
More information about the cfe-commits
mailing list