[clang] [llvm] Implement WaveGetLaneCount SPIRV lowering (PR #227160)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 12:47:10 PDT 2026


================
@@ -33,9 +33,18 @@
 #include <optional>
 #include <vector>
 
-// A function generator macro for picking the right intrinsic
-// for the target backend
-#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix)       \
+// Function generator macros for picking the right intrinsic
+// for the target backend.
+#define HLSL_INTRINSIC_FUNCTION_CHOOSER(_1, _2, _3, NAME, ...) NAME
+
+#define GENERATE_HLSL_INTRINSIC_FUNCTION(...)                                  \
+  HLSL_INTRINSIC_FUNCTION_CHOOSER(                                             \
+      __VA_ARGS__, GENERATE_HLSL_INTRINSIC_FUNCTION3,                          \
+      GENERATE_HLSL_INTRINSIC_FUNCTION2,                                       \
+      /* dummy to solve pre-C++20 errors */ ignored)(__VA_ARGS__)
----------------
farzonl wrote:

The feeback I was given on a similar change I wanted to make was that the preprocessor is the wrong tool to do this https://github.com/llvm/llvm-project/pull/117648/changes

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


More information about the cfe-commits mailing list