[llvm] [DirectX] Add support for vector_reduce_add (PR #117646)

Tex Riddell via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 11:26:17 PST 2024


================
@@ -67,11 +67,44 @@ static bool isIntrinsicExpansion(Function &F) {
   case Intrinsic::dx_sign:
   case Intrinsic::dx_step:
   case Intrinsic::dx_radians:
+  case Intrinsic::vector_reduce_add:
+  case Intrinsic::vector_reduce_fadd:
     return true;
   }
   return false;
 }
 
+static Value *expandVecReduceFAdd(CallInst *Orig) {
+  // Note: vector_reduce_fadd first argument is a starting value
+  // Our use doesn't need it, so ignoring argument zero.
----------------
tex3d wrote:

Why not write it to handle the starting value, and if it's a constant zero, then the first add is folded/skipped?

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


More information about the llvm-commits mailing list