[llvm] [SLP] Cost reduce.add(mul(ext, ext)) as a dot-product reduction (PR #224066)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 03:58:15 PDT 2026
================
@@ -0,0 +1,218 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=slp-vectorizer -slp-threshold=28 -S < %s | FileCheck %s
+
+; The reduce.add(mul(ext, ext)) idiom lowers to a single dot-product
+; reduction (UDOT/SDOT) when the target supports it. The threshold is set
+; between the plain reduction cost and the fused dot-product cost so the
+; reduction is profitable only when the dot-product cost applies: the
+; +dotprod function vectorizes, the plain function stays scalar.
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
+target triple = "aarch64"
----------------
alexey-bataev wrote:
```suggestion
; RUN: opt -passes=slp-vectorizer -slp-threshold=28 -S -mtriple=aarch64 < %s | FileCheck %s
; The reduce.add(mul(ext, ext)) idiom lowers to a single dot-product
; reduction (UDOT/SDOT) when the target supports it. The threshold is set
; between the plain reduction cost and the fused dot-product cost so the
; reduction is profitable only when the dot-product cost applies: the
; +dotprod function vectorizes, the plain function stays scalar.
```
https://github.com/llvm/llvm-project/pull/224066
More information about the llvm-commits
mailing list