[llvm] Add LoopVectorizer support for `llvm.vector.partial.reduce.fadd` (PR #163975)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 19 12:53:12 PST 2026


================
@@ -0,0 +1,700 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --version 6
+; RUN: opt -passes=loop-vectorize -enable-epilogue-vectorization=false -S < %s | FileCheck %s --check-prefixes=CHECK
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
----------------
fhahn wrote:

Could you also add test a test for some unsupported FP types, like `fp128`.

And without the SVE features.

I think currently the patch will crash on something like 

```
target triple = "arm64-apple-macosx15.0.0"

define double @foo(ptr %A, ptr %B) {
entry:
  br label %loop

loop:
  %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
  %red = phi double [ 0.000000e+00, %entry ], [ %red.next, %loop ]
  %gep.A = getelementptr inbounds float, ptr %A, i64 %iv
  %l.A = load float, ptr %gep.A
  %gep.B = getelementptr inbounds float, ptr %B, i64 %iv
  %l.B = load float, ptr %gep.B
  %ext.A = fpext float %l.A to double
  %ext.B = fpext float %l.B to double
  %mul9 = fmul double %ext.A, %ext.B
  %red.next = fadd double %red, %mul9
  %iv.next = add i64 %iv, 1
  %ec = icmp eq i64 %iv.next, 100
  br i1 %ec, label %exit, label %loop

exit:
  ret double %red.next
}
```

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


More information about the llvm-commits mailing list