[clang] [llvm] [HLSL] Add WaveActiveBitOr HLSL function (PR #178056)

Tex Riddell via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 11:51:52 PST 2026


================
@@ -329,6 +329,51 @@ static Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
   return RT.getFirstBitUHighIntrinsic();
 }
 
+// select and return a specific wave bit op intrinsic,
+// based on the provided op kind.
+// OpKinds:
+// And = 0, bitwise and of values
+// Or = 1,  bitwise or of values
+// Xor = 2, bitwise xor of values
+static Intrinsic::ID getWaveBitOpIntrinsic(int OpKind,
+                                           llvm::Triple::ArchType Arch,
+                                           CGHLSLRuntime &RT, QualType QT) {
+  switch (Arch) {
+  case llvm::Triple::spirv:
+    switch (OpKind) {
+
+    case 0:
+    case 2: {
+      llvm_unreachable("Not implemented yet!");
+    }
+    case 1: {
+      return Intrinsic::spv_wave_bit_or;
+    }
+    default: {
----------------
tex3d wrote:

Why the extra scope `{}` around single statement `llvm_unreachable` or `return`?

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


More information about the cfe-commits mailing list