================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to