[clang] [llvm] [HLSL][DXIL][SPRIV] Added WaveActiveProduct intrinsic #164385 (PR #165109)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 11:50:16 PST 2026


================
@@ -257,6 +257,24 @@ static Intrinsic::ID getWaveActiveSumIntrinsic(llvm::Triple::ArchType Arch,
   }
 }
 
+// Return wave active product that corresponds to the QT scalar type
+static Intrinsic::ID getWaveActiveProductIntrinsic(llvm::Triple::ArchType Arch,
+                                                   CGHLSLRuntime &RT,
+                                                   QualType QT) {
+  switch (Arch) {
+  case llvm::Triple::spirv:
+    return Intrinsic::spv_wave_product;
+  case llvm::Triple::dxil: {
+    if (QT->isUnsignedIntegerType())
+      return Intrinsic::dx_wave_uproduct;
+    return Intrinsic::dx_wave_product;
+  }
+  default:
+    llvm_unreachable("Intrinsic WaveActiveProduct"
+                     " not supported by target architecture");
+  }
+}
+
 // Return wave active max that corresponds to the QT scalar type
 static Intrinsic::ID getWaveActiveMaxIntrinsic(llvm::Triple::ArchType Arch,
                                                CGHLSLRuntime &RT, QualType QT) {
----------------
farzonl wrote:

This function doesn't use RT, you use `CGM.getHLSLRuntime()` when you call `getWaveActiveProductIntrinsic`. but  getWaveActiveProductIntrinsic also doesn't use RT.

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


More information about the llvm-commits mailing list