[llvm] Add `llvm.vector.partial.reduce.fadd` intrinsic (PR #159776)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 09:49:48 PDT 2025


================
@@ -0,0 +1,66 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2p1 < %s | FileCheck %s
+
+define <vscale x 4 x float> @fdot_wide_vl128(<vscale x 4 x float> %acc, <vscale x 8 x half> %a, <vscale x 8 x half> %b) {
+; CHECK-LABEL: fdot_wide_vl128:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    fdot z0.s, z1.h, z2.h
+; CHECK-NEXT:    ret
+entry:
+  %a.wide = fpext <vscale x 8 x half> %a to <vscale x 8 x float>
+  %b.wide = fpext <vscale x 8 x half> %b to <vscale x 8 x float>
+  %mult = fmul <vscale x 8 x float> %a.wide, %b.wide
+  %partial.reduce = call <vscale x 4 x float> @llvm.vector.partial.reduce.fadd(<vscale x 4 x float> %acc, <vscale x 8 x float> %mult)
----------------
sdesmalen-arm wrote:

It would also be good to have tests that don't necessarily map to `fdot` instructions (i.e. just the partial.reduce.fadd intrinsic on operands passed in as arguments directly), to make sure those are code-generated correctly as well. And do this for different types (half, float, double).

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


More information about the llvm-commits mailing list