[llvm] [AArch64][CostModel] Lower wide fixed-length vector reductions cost (PR #211824)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 08:17:05 PDT 2026


https://github.com/gbossu updated https://github.com/llvm/llvm-project/pull/211824

>From 5ea552be68c289d8d292281d9d86913994175bdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Bossu?= <gaetan.bossu at arm.com>
Date: Fri, 24 Jul 2026 09:25:19 +0000
Subject: [PATCH 1/3] Precommit tests

---
 .../CostModel/AArch64/sve-vls-reduce-fp.ll    | 173 +++++++++++
 .../CostModel/AArch64/sve-vls-reduce-int.ll   | 283 ++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
 create mode 100644 llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll

diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
new file mode 100644
index 0000000000000..af841d70282d4
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
@@ -0,0 +1,173 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 -aarch64-sve-vector-bits-max=128 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 -aarch64-sve-vector-bits-max=256 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 -aarch64-sve-vector-bits-max=512 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+
+; This tests the cost of fixed-length reductions for SVE,
+; either for a minimum vscale or a fixed vscale (aka VLS).
+; For the NEON equivalent test, see reduce-*.ll
+; Codegen tests are in sve-fixed-length-fp-reduce.ll
+
+define void @reduce_fadd_strict() {
+; VSCALE-1-LABEL: 'reduce_fadd_strict'
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:120 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:44 Lat:88 SizeLat:56 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:12 CodeSize:10 Lat:20 SizeLat:12 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:24 CodeSize:20 Lat:40 SizeLat:24 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_fadd_strict'
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:94 Lat:188 SizeLat:124 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_fadd_strict'
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:126 CodeSize:95 Lat:190 SizeLat:126 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> undef)
+  %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> undef)
+  %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> undef)
+
+  %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> undef)
+  %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> undef)
+  %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> undef)
+
+  %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> undef)
+  %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> undef)
+  %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> undef)
+
+  %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> undef)
+  %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> undef)
+  %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> undef)
+
+  %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+  %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+  ret void
+}
+
+define void @reduce_fadd_fast() {
+; VSCALE-1-LABEL: 'reduce_fadd_fast'
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:87 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:198 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_fadd_fast'
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:138 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_fadd_fast'
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:127 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> undef)
+  %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> undef)
+  %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> undef)
+
+  %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> undef)
+  %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> undef)
+  %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> undef)
+
+  %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> undef)
+  %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> undef)
+  %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> undef)
+
+  %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> undef)
+  %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> undef)
+  %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> undef)
+
+  %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
+  %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+  ret void
+}
+
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; VSCALE-ANY: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
new file mode 100644
index 0000000000000..1a2c9e4b8454f
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
@@ -0,0 +1,283 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 -aarch64-sve-vector-bits-max=128 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 -aarch64-sve-vector-bits-max=256 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
+; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 -aarch64-sve-vector-bits-max=512 \
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+
+; This tests the cost of fixed-length reductions for SVE,
+; either for a minimum vscale or a fixed vscale (aka VLS).
+; For the NEON equivalent test, see reduce-*.ll
+; Codegen tests are in sve-fixed-length-int-reduce.ll
+
+define void @reduce_add() {
+; VSCALE-1-LABEL: 'reduce_add'
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_add'
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_add'
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
+  %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+  %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+
+  %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
+  %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+  %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+
+  %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
+  %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+  %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+
+  %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
+  %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+  %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+  ret void
+}
+
+define void @reduce_and() {
+; VSCALE-1-LABEL: 'reduce_and'
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_and'
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_and'
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
+  %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+  %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+
+  %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
+  %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+  %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+
+  %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
+  %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+  %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+
+  %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
+  %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+  %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+  ret void
+}
+
+define void @reduce_or() {
+; VSCALE-1-LABEL: 'reduce_or'
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_or'
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_or'
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
+  %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+  %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+
+  %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
+  %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+  %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+
+  %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
+  %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+  %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+
+  %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
+  %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+  %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+  ret void
+}
+
+define void @reduce_xor() {
+; VSCALE-1-LABEL: 'reduce_xor'
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-2-LABEL: 'reduce_xor'
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+; VSCALE-4-LABEL: 'reduce_xor'
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
+;
+  %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
+  %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+  %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+
+  %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
+  %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+  %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+
+  %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
+  %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+  %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+
+  %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
+  %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+  %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+  ret void
+}
+
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; VSCALE-ANY: {{.*}}

>From a5431eefe7a52fe0e083f9ca9c038e922fdcc0bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Bossu?= <gaetan.bossu at arm.com>
Date: Wed, 4 Mar 2026 16:05:37 +0000
Subject: [PATCH 2/3] [AArch64][CostModel] Lower wide fixed-length vector
 reductions cost

When vscale is known > 1, SVE will be used to perform the reduction.
This should be reflected in the cost model.
---
 .../AArch64/AArch64TargetTransformInfo.cpp    |   7 +-
 .../CostModel/AArch64/sve-vls-reduce-fp.ll    |  20 +--
 .../CostModel/AArch64/sve-vls-reduce-int.ll   | 128 +++++++++---------
 3 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index cbf3cfaa1de54..99a0c56c750b2 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -6152,11 +6152,12 @@ AArch64TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
     return Cost;
   }
 
-  if (isa<ScalableVectorType>(ValTy))
-    return getArithmeticReductionCostSVE(Opcode, ValTy, CostKind);
-
   std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(ValTy);
   MVT MTy = LT.second;
+
+  if (isa<ScalableVectorType>(ValTy) || TLI->useSVEForFixedLengthVectorVT(MTy))
+    return getArithmeticReductionCostSVE(Opcode, ValTy, CostKind);
+
   int ISD = TLI->InstructionOpcodeToISD(Opcode);
   assert(ISD && "Invalid opcode");
 
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
index af841d70282d4..c909f584f1ba9 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
@@ -116,34 +116,34 @@ define void @reduce_fadd_fast() {
 ;
 ; VSCALE-2-LABEL: 'reduce_fadd_fast'
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:138 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_fadd_fast'
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:127 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
index 1a2c9e4b8454f..81bdf7360ba78 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
@@ -41,32 +41,32 @@ define void @reduce_add() {
 ;
 ; VSCALE-2-LABEL: 'reduce_add'
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_add'
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
   %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
@@ -105,32 +105,32 @@ define void @reduce_and() {
 ;
 ; VSCALE-2-LABEL: 'reduce_and'
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_and'
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
   %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
@@ -169,32 +169,32 @@ define void @reduce_or() {
 ;
 ; VSCALE-2-LABEL: 'reduce_or'
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_or'
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
   %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
@@ -233,32 +233,32 @@ define void @reduce_xor() {
 ;
 ; VSCALE-2-LABEL: 'reduce_xor'
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:776 CodeSize:391 Lat:776 SizeLat:776 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:327 CodeSize:166 Lat:327 SizeLat:327 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:134 CodeSize:69 Lat:134 SizeLat:134 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:53 CodeSize:28 Lat:53 SizeLat:53 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_xor'
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:1544 CodeSize:775 Lat:1544 SizeLat:1544 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:647 CodeSize:326 Lat:647 SizeLat:647 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:262 CodeSize:133 Lat:262 SizeLat:262 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:36 CodeSize:19 Lat:36 SizeLat:36 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:101 CodeSize:52 Lat:101 SizeLat:101 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
   %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)

>From eccfc6063a906f7d329808ebaa9e063b8abef154 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABtan=20Bossu?= <gaetan.bossu at arm.com>
Date: Fri, 24 Jul 2026 15:15:18 +0000
Subject: [PATCH 3/3] Tidy tests

 - Replace undef with poison
 - Remove unused VSCALE-ANY prefix
---
 .../CostModel/AArch64/sve-vls-reduce-fp.ll    | 239 ++++++-----
 .../CostModel/AArch64/sve-vls-reduce-int.ll   | 399 +++++++++---------
 2 files changed, 316 insertions(+), 322 deletions(-)

diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
index c909f584f1ba9..7716adb5bd54c 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-fp.ll
@@ -1,22 +1,22 @@
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-1
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 -aarch64-sve-vector-bits-max=128 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-1
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-2
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 -aarch64-sve-vector-bits-max=256 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-2
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-4
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 -aarch64-sve-vector-bits-max=512 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-4
 
 ; This tests the cost of fixed-length reductions for SVE,
 ; either for a minimum vscale or a fixed vscale (aka VLS).
@@ -25,149 +25,146 @@
 
 define void @reduce_fadd_strict() {
 ; VSCALE-1-LABEL: 'reduce_fadd_strict'
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:120 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:44 Lat:88 SizeLat:56 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:12 CodeSize:10 Lat:20 SizeLat:12 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:24 CodeSize:20 Lat:40 SizeLat:24 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:120 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:56 CodeSize:44 Lat:88 SizeLat:56 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:12 CodeSize:10 Lat:20 SizeLat:12 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:24 CodeSize:20 Lat:40 SizeLat:24 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_fadd_strict'
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:94 Lat:188 SizeLat:124 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:94 Lat:188 SizeLat:124 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:60 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:28 CodeSize:22 Lat:44 SizeLat:28 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_fadd_strict'
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:126 CodeSize:95 Lat:190 SizeLat:126 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:126 CodeSize:95 Lat:190 SizeLat:126 for: %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:110 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:220 CodeSize:46 Lat:92 SizeLat:60 for: %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:440 CodeSize:92 Lat:184 SizeLat:120 for: %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:62 CodeSize:47 Lat:94 SizeLat:62 for: %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:6 CodeSize:5 Lat:10 SizeLat:6 for: %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:14 CodeSize:11 Lat:22 SizeLat:14 for: %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:23 Lat:46 SizeLat:30 for: %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:22 CodeSize:4 Lat:8 SizeLat:4 for: %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:44 CodeSize:8 Lat:16 SizeLat:8 for: %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> undef)
-  %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> undef)
-  %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> undef)
+  %fadd_v8f16 = call half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> poison)
+  %fadd_v16f16 = call half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> poison)
+  %fadd_v32f16 = call half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> poison)
 
-  %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> undef)
-  %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> undef)
-  %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> undef)
+  %fadd_v8bf16 = call bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> poison)
+  %fadd_v16bf16 = call bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> poison)
+  %fadd_v32bf16 = call bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> poison)
 
-  %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> undef)
-  %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> undef)
-  %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> undef)
+  %fadd_v4f32 = call float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> poison)
+  %fadd_v8f32 = call float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> poison)
+  %fadd_v16f32 = call float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> poison)
 
-  %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> undef)
-  %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> undef)
-  %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> undef)
+  %fadd_v2f64 = call double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> poison)
+  %fadd_v4f64 = call double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> poison)
+  %fadd_v8f64 = call double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> poison)
 
-  %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-  %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+  %fadd_v2f128 = call fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+  %fadd_v4f128 = call fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
   ret void
 }
 
 define void @reduce_fadd_fast() {
 ; VSCALE-1-LABEL: 'reduce_fadd_fast'
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:87 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:198 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:87 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:124 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:198 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_fadd_fast'
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:138 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:138 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:3 CodeSize:3 Lat:5 SizeLat:3 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_fadd_fast'
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:127 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.000000e+00, <8 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.000000e+00, <16 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.000000e+00, <32 x half> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:57 CodeSize:27 Lat:33 SizeLat:27 for: %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.000000e+00, <8 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:84 CodeSize:44 Lat:52 SizeLat:44 for: %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.000000e+00, <16 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:127 CodeSize:77 Lat:87 SizeLat:77 for: %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.000000e+00, <32 x bfloat> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.000000e+00, <8 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.000000e+00, <16 x float> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 1 for: %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.000000e+00, <2 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.000000e+00, <4 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.000000e+00, <8 x double> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:10 CodeSize:1 Lat:3 SizeLat:1 for: %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:30 CodeSize:2 Lat:6 SizeLat:2 for: %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> undef)
-  %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> undef)
-  %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> undef)
+  %fadd_v8f16 = call fast half @llvm.vector.reduce.fadd.v8f16(half 0.0, <8 x half> poison)
+  %fadd_v16f16 = call fast half @llvm.vector.reduce.fadd.v16f16(half 0.0, <16 x half> poison)
+  %fadd_v32f16 = call fast half @llvm.vector.reduce.fadd.v32f16(half 0.0, <32 x half> poison)
 
-  %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> undef)
-  %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> undef)
-  %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> undef)
+  %fadd_v8bf16 = call fast bfloat @llvm.vector.reduce.fadd.v8bf16(bfloat 0.0, <8 x bfloat> poison)
+  %fadd_v16bf16 = call fast bfloat @llvm.vector.reduce.fadd.v16bf16(bfloat 0.0, <16 x bfloat> poison)
+  %fadd_v32bf16 = call fast bfloat @llvm.vector.reduce.fadd.v32bf16(bfloat 0.0, <32 x bfloat> poison)
 
-  %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> undef)
-  %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> undef)
-  %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> undef)
+  %fadd_v4f32 = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.0, <4 x float> poison)
+  %fadd_v8f32 = call fast float @llvm.vector.reduce.fadd.v8f32(float 0.0, <8 x float> poison)
+  %fadd_v16f32 = call fast float @llvm.vector.reduce.fadd.v16f32(float 0.0, <16 x float> poison)
 
-  %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> undef)
-  %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> undef)
-  %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> undef)
+  %fadd_v2f64 = call fast double @llvm.vector.reduce.fadd.v2f64(double 0.0, <2 x double> poison)
+  %fadd_v4f64 = call fast double @llvm.vector.reduce.fadd.v4f64(double 0.0, <4 x double> poison)
+  %fadd_v8f64 = call fast double @llvm.vector.reduce.fadd.v8f64(double 0.0, <8 x double> poison)
 
-  %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 undef, <2 x fp128> undef)
-  %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 undef, <4 x fp128> undef)
+  %fadd_v2f128 = call fast fp128 @llvm.vector.reduce.fadd.v2f128(fp128 poison, <2 x fp128> poison)
+  %fadd_v4f128 = call fast fp128 @llvm.vector.reduce.fadd.v4f128(fp128 poison, <4 x fp128> poison)
   ret void
 }
-
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; VSCALE-ANY: {{.*}}
diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
index 81bdf7360ba78..0590cdef30029 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-vls-reduce-int.ll
@@ -1,22 +1,22 @@
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-1
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=128 -aarch64-sve-vector-bits-max=128 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-1
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-1
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-2
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=256 -aarch64-sve-vector-bits-max=256 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-2
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-2
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-4
 ; RUN: opt < %s -mtriple=aarch64 -mattr=+sve -passes="print<cost-model>" 2>&1 -disable-output \
 ; RUN:    -cost-kind=all -aarch64-sve-vector-bits-min=512 -aarch64-sve-vector-bits-max=512 \
-; RUN:    | FileCheck %s --check-prefixes=VSCALE-ANY,VSCALE-4
+; RUN:    | FileCheck %s --check-prefixes=VSCALE-4
 
 ; This tests the cost of fixed-length reductions for SVE,
 ; either for a minimum vscale or a fixed vscale (aka VLS).
@@ -25,259 +25,256 @@
 
 define void @reduce_add() {
 ; VSCALE-1-LABEL: 'reduce_add'
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_add'
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_add'
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> undef)
-  %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> undef)
-  %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> undef)
+  %V16i8 = call i8 @llvm.vector.reduce.add.v16i8(<16 x i8> poison)
+  %V32i8 = call i8 @llvm.vector.reduce.add.v32i8(<32 x i8> poison)
+  %V64i8 = call i8 @llvm.vector.reduce.add.v64i8(<64 x i8> poison)
 
-  %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> undef)
-  %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> undef)
-  %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> undef)
+  %V8i16 = call i16 @llvm.vector.reduce.add.v8i16(<8 x i16> poison)
+  %V16i16 = call i16 @llvm.vector.reduce.add.v16i16(<16 x i16> poison)
+  %V32i16 = call i16 @llvm.vector.reduce.add.v32i16(<32 x i16> poison)
 
-  %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> undef)
-  %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> undef)
-  %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> undef)
+  %V4i32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> poison)
+  %V8i32 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> poison)
+  %V16i32 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> poison)
 
-  %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> undef)
-  %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> undef)
-  %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> undef)
+  %V2i64 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> poison)
+  %V4i64 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> poison)
+  %V8i64 = call i64 @llvm.vector.reduce.add.v8i64(<8 x i64> poison)
   ret void
 }
 
 define void @reduce_and() {
 ; VSCALE-1-LABEL: 'reduce_and'
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_and'
-; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_and'
-; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> undef)
-  %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> undef)
-  %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> undef)
+  %V16i8 = call i8 @llvm.vector.reduce.and.v16i8(<16 x i8> poison)
+  %V32i8 = call i8 @llvm.vector.reduce.and.v32i8(<32 x i8> poison)
+  %V64i8 = call i8 @llvm.vector.reduce.and.v64i8(<64 x i8> poison)
 
-  %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> undef)
-  %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> undef)
-  %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> undef)
+  %V8i16 = call i16 @llvm.vector.reduce.and.v8i16(<8 x i16> poison)
+  %V16i16 = call i16 @llvm.vector.reduce.and.v16i16(<16 x i16> poison)
+  %V32i16 = call i16 @llvm.vector.reduce.and.v32i16(<32 x i16> poison)
 
-  %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> undef)
-  %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> undef)
-  %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> undef)
+  %V4i32 = call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> poison)
+  %V8i32 = call i32 @llvm.vector.reduce.and.v8i32(<8 x i32> poison)
+  %V16i32 = call i32 @llvm.vector.reduce.and.v16i32(<16 x i32> poison)
 
-  %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> undef)
-  %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> undef)
-  %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> undef)
+  %V2i64 = call i64 @llvm.vector.reduce.and.v2i64(<2 x i64> poison)
+  %V4i64 = call i64 @llvm.vector.reduce.and.v4i64(<4 x i64> poison)
+  %V8i64 = call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> poison)
   ret void
 }
 
 define void @reduce_or() {
 ; VSCALE-1-LABEL: 'reduce_or'
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_or'
-; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_or'
-; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> undef)
-  %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> undef)
-  %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> undef)
+  %V16i8 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> poison)
+  %V32i8 = call i8 @llvm.vector.reduce.or.v32i8(<32 x i8> poison)
+  %V64i8 = call i8 @llvm.vector.reduce.or.v64i8(<64 x i8> poison)
 
-  %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> undef)
-  %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> undef)
-  %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> undef)
+  %V8i16 = call i16 @llvm.vector.reduce.or.v8i16(<8 x i16> poison)
+  %V16i16 = call i16 @llvm.vector.reduce.or.v16i16(<16 x i16> poison)
+  %V32i16 = call i16 @llvm.vector.reduce.or.v32i16(<32 x i16> poison)
 
-  %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> undef)
-  %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> undef)
-  %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> undef)
+  %V4i32 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> poison)
+  %V8i32 = call i32 @llvm.vector.reduce.or.v8i32(<8 x i32> poison)
+  %V16i32 = call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> poison)
 
-  %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> undef)
-  %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> undef)
-  %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> undef)
+  %V2i64 = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> poison)
+  %V4i64 = call i64 @llvm.vector.reduce.or.v4i64(<4 x i64> poison)
+  %V8i64 = call i64 @llvm.vector.reduce.or.v8i64(<8 x i64> poison)
   ret void
 }
 
 define void @reduce_xor() {
 ; VSCALE-1-LABEL: 'reduce_xor'
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 10 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 7 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 9 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 8 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 4 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> poison)
+; VSCALE-1-NEXT:  Cost Model: Found costs of 6 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> poison)
 ; VSCALE-1-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-2-LABEL: 'reduce_xor'
-; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> poison)
+; VSCALE-2-NEXT:  Cost Model: Found costs of 3 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> poison)
 ; VSCALE-2-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
 ; VSCALE-4-LABEL: 'reduce_xor'
-; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 7 for: %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 6 for: %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 5 for: %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 3 for: %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> poison)
+; VSCALE-4-NEXT:  Cost Model: Found costs of 2 for: %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> poison)
 ; VSCALE-4-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
 ;
-  %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> undef)
-  %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> undef)
-  %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> undef)
+  %V16i8 = call i8 @llvm.vector.reduce.xor.v16i8(<16 x i8> poison)
+  %V32i8 = call i8 @llvm.vector.reduce.xor.v32i8(<32 x i8> poison)
+  %V64i8 = call i8 @llvm.vector.reduce.xor.v64i8(<64 x i8> poison)
 
-  %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> undef)
-  %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> undef)
-  %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> undef)
+  %V8i16 = call i16 @llvm.vector.reduce.xor.v8i16(<8 x i16> poison)
+  %V16i16 = call i16 @llvm.vector.reduce.xor.v16i16(<16 x i16> poison)
+  %V32i16 = call i16 @llvm.vector.reduce.xor.v32i16(<32 x i16> poison)
 
-  %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> undef)
-  %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> undef)
-  %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> undef)
+  %V4i32 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> poison)
+  %V8i32 = call i32 @llvm.vector.reduce.xor.v8i32(<8 x i32> poison)
+  %V16i32 = call i32 @llvm.vector.reduce.xor.v16i32(<16 x i32> poison)
 
-  %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> undef)
-  %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> undef)
-  %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> undef)
+  %V2i64 = call i64 @llvm.vector.reduce.xor.v2i64(<2 x i64> poison)
+  %V4i64 = call i64 @llvm.vector.reduce.xor.v4i64(<4 x i64> poison)
+  %V8i64 = call i64 @llvm.vector.reduce.xor.v8i64(<8 x i64> poison)
   ret void
 }
-
-;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
-; VSCALE-ANY: {{.*}}



More information about the llvm-commits mailing list