[llvm] [DirectX][ShaderFlags] Add analysis for `WaveOps` flag (PR #118140)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 10:13:08 PST 2025


================
@@ -30,6 +30,40 @@
 using namespace llvm;
 using namespace llvm::dxil;
 
+static bool checkWaveOps(Intrinsic::ID IID) {
+  switch (IID) {
+  default:
+    return false;
+  case Intrinsic::dx_wave_is_first_lane:
+  case Intrinsic::dx_wave_getlaneindex:
+  case Intrinsic::dx_wave_any:
+  case Intrinsic::dx_wave_all:
+  case Intrinsic::dx_wave_readlane:
+  case Intrinsic::dx_wave_active_countbits:
+  // Wave Active Op Variants
+  case Intrinsic::dx_wave_reduce_sum:
+  case Intrinsic::dx_wave_reduce_usum:
+  case Intrinsic::dx_wave_reduce_max:
+  case Intrinsic::dx_wave_reduce_umax:
+
+    // Currently unsupported intrinsics
+    // case Intrinsic::dx_WaveGetLaneCount:
+    // case Intrinsic::dx_WaveActiveAllEqual:
+    // case Intrinsic::dx_WaveActiveBallot:
+    // case Intrinsic::dx_WaveReadLaneFirst:
+    // case Intrinsic::dx_WaveActiveBit:
+    // case Intrinsic::dx_WavePrefixOp:
+    // case Intrinsic::dx_QuadReadLaneAt:
+    // case Intrinsic::dx_QuadOp:
+    // case Intrinsic::dx_WavePrefixBitCount:
+    // case Intrinsic::dx_WaveMatch:
+    // case Intrinsic::dx_WaveMultiPrefixOp:
+    // case Intrinsic::dx_WaveMultiPrefixBitCount:
+    // case Intrinsic::dx_QuadVote:
----------------
bogner wrote:

We have proposed spellings for all of these, so you could name these to match those if you like: https://github.com/llvm/wg-hlsl/blob/main/proposals/0014-consistent-naming-for-dx-intrinsics.md#wave-ops

Also clang-format does something kind of awkward here - might be better to put this comment outside of the switch.

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


More information about the llvm-commits mailing list