[llvm] beb06f3 - [RISCV] Add cost model test coverage of scalable reductions

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 14:33:07 PDT 2022


Author: Philip Reames
Date: 2022-06-06T14:32:30-07:00
New Revision: beb06f3c53385e94010d75065b678ef4d45f629e

URL: https://github.com/llvm/llvm-project/commit/beb06f3c53385e94010d75065b678ef4d45f629e
DIFF: https://github.com/llvm/llvm-project/commit/beb06f3c53385e94010d75065b678ef4d45f629e.diff

LOG: [RISCV] Add cost model test coverage of scalable reductions

Added: 
    llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll
    llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll b/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll
new file mode 100644
index 000000000000..132331143549
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-fp.ll
@@ -0,0 +1,696 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=riscv32 -mattr=+d,+zfh,+experimental-zvfh,+v -passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefixes=CHECK
+; RUN: opt < %s -mtriple=riscv64 -mattr=+d,+zfh,+experimental-zvfh,+v -passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefixes=CHECK
+
+declare half @llvm.vector.reduce.fadd.nxv1f16(half, <vscale x 1 x half>)
+
+define half @vreduce_fadd_nxv1f16(<vscale x 1 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv1f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call reassoc half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_ord_fadd_nxv1f16(<vscale x 1 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv1f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fadd.nxv2f16(half, <vscale x 2 x half>)
+
+define half @vreduce_fadd_nxv2f16(<vscale x 2 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv2f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call reassoc half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_ord_fadd_nxv2f16(<vscale x 2 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv2f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fadd.nxv4f16(half, <vscale x 4 x half>)
+
+define half @vreduce_fadd_nxv4f16(<vscale x 4 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv4f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call reassoc half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_ord_fadd_nxv4f16(<vscale x 4 x half> %v, half %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv4f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
+  ret half %red
+}
+
+declare float @llvm.vector.reduce.fadd.nxv1f32(float, <vscale x 1 x float>)
+
+define float @vreduce_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv1f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_ord_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv1f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fwadd_nxv1f32(<vscale x 1 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv1f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
+  ret float %red
+}
+
+define float @vreduce_ord_fwadd_nxv1f32(<vscale x 1 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv1f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
+  %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fadd.nxv2f32(float, <vscale x 2 x float>)
+
+define float @vreduce_fadd_nxv2f32(<vscale x 2 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv2f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_ord_fadd_nxv2f32(<vscale x 2 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv2f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fwadd_nxv2f32(<vscale x 2 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv2f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
+  ret float %red
+}
+
+define float @vreduce_ord_fwadd_nxv2f32(<vscale x 2 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv2f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
+  %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fadd.nxv4f32(float, <vscale x 4 x float>)
+
+define float @vreduce_fadd_nxv4f32(<vscale x 4 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv4f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_ord_fadd_nxv4f32(<vscale x 4 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv4f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fwadd_nxv4f32(<vscale x 4 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv4f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
+  %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
+  ret float %red
+}
+
+define float @vreduce_ord_fwadd_nxv4f32(<vscale x 4 x half> %v, float %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv4f32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
+  %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
+  ret float %red
+}
+
+declare double @llvm.vector.reduce.fadd.nxv1f64(double, <vscale x 1 x double>)
+
+define double @vreduce_fadd_nxv1f64(<vscale x 1 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv1f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_ord_fadd_nxv1f64(<vscale x 1 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv1f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fwadd_nxv1f64(<vscale x 1 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv1f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
+  ret double %red
+}
+
+define double @vreduce_ord_fwadd_nxv1f64(<vscale x 1 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv1f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
+  %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fadd.nxv2f64(double, <vscale x 2 x double>)
+
+define double @vreduce_fadd_nxv2f64(<vscale x 2 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv2f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_ord_fadd_nxv2f64(<vscale x 2 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv2f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fwadd_nxv2f64(<vscale x 2 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv2f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
+  ret double %red
+}
+
+define double @vreduce_ord_fwadd_nxv2f64(<vscale x 2 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv2f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
+  %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fadd.nxv4f64(double, <vscale x 4 x double>)
+
+define double @vreduce_fadd_nxv4f64(<vscale x 4 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fadd_nxv4f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_ord_fadd_nxv4f64(<vscale x 4 x double> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fadd_nxv4f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fwadd_nxv4f64(<vscale x 4 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_fwadd_nxv4f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
+  %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
+  ret double %red
+}
+
+define double @vreduce_ord_fwadd_nxv4f64(<vscale x 4 x float> %v, double %s) {
+; CHECK-LABEL: 'vreduce_ord_fwadd_nxv4f64'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
+  %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
+  ret double %red
+}
+
+declare half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half>)
+
+define half @vreduce_fmin_nxv1f16(<vscale x 1 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_fmin_nxv1f16_nonans(<vscale x 1 x half> %v) #0 {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f16_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call nnan half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_fmin_nxv1f16_nonans_noinfs(<vscale x 1 x half> %v) #1 {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f16_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call nnan ninf half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half>)
+
+define half @vreduce_fmin_nxv2f16(<vscale x 2 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv2f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half>)
+
+define half @vreduce_fmin_nxv4f16(<vscale x 4 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv4f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmin.nxv64f16(<vscale x 64 x half>)
+
+define half @vreduce_fmin_nxv64f16(<vscale x 64 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv64f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmin.nxv64f16(<vscale x 64 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmin.nxv64f16(<vscale x 64 x half> %v)
+  ret half %red
+}
+
+declare float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float>)
+
+define float @vreduce_fmin_nxv1f32(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fmin_nxv1f32_nonans(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f32_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call nnan float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fmin_nxv1f32_nonans_noinfs(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f32_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call nnan ninf float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float>)
+
+define float @vreduce_fmin_nxv2f32(<vscale x 2 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv2f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float>)
+
+define float @vreduce_fmin_nxv4f32(<vscale x 4 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv4f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmin.nxv32f32(<vscale x 32 x float>)
+
+define float @vreduce_fmin_nxv32f32(<vscale x 32 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv32f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmin.nxv32f32(<vscale x 32 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmin.nxv32f32(<vscale x 32 x float> %v)
+  ret float %red
+}
+
+declare double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double>)
+
+define double @vreduce_fmin_nxv1f64(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fmin_nxv1f64_nonans(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f64_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call nnan double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fmin_nxv1f64_nonans_noinfs(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv1f64_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call nnan ninf double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double>)
+
+define double @vreduce_fmin_nxv2f64(<vscale x 2 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv2f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmin.nxv4f64(<vscale x 4 x double>)
+
+define double @vreduce_fmin_nxv4f64(<vscale x 4 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv4f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmin.nxv4f64(<vscale x 4 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmin.nxv4f64(<vscale x 4 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmin.nxv16f64(<vscale x 16 x double>)
+
+define double @vreduce_fmin_nxv16f64(<vscale x 16 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmin_nxv16f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmin.nxv16f64(<vscale x 16 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmin.nxv16f64(<vscale x 16 x double> %v)
+  ret double %red
+}
+
+declare half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half>)
+
+define half @vreduce_fmax_nxv1f16(<vscale x 1 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_fmax_nxv1f16_nonans(<vscale x 1 x half> %v) #0 {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f16_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call nnan half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+define half @vreduce_fmax_nxv1f16_nonans_noinfs(<vscale x 1 x half> %v) #1 {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f16_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call nnan ninf half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half>)
+
+define half @vreduce_fmax_nxv2f16(<vscale x 2 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv2f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half>)
+
+define half @vreduce_fmax_nxv4f16(<vscale x 4 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv4f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half> %v)
+  ret half %red
+}
+
+declare half @llvm.vector.reduce.fmax.nxv64f16(<vscale x 64 x half>)
+
+define half @vreduce_fmax_nxv64f16(<vscale x 64 x half> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv64f16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call half @llvm.vector.reduce.fmax.nxv64f16(<vscale x 64 x half> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret half %red
+;
+  %red = call half @llvm.vector.reduce.fmax.nxv64f16(<vscale x 64 x half> %v)
+  ret half %red
+}
+
+declare float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float>)
+
+define float @vreduce_fmax_nxv1f32(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fmax_nxv1f32_nonans(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f32_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call nnan float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+define float @vreduce_fmax_nxv1f32_nonans_noinfs(<vscale x 1 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f32_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call nnan ninf float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float>)
+
+define float @vreduce_fmax_nxv2f32(<vscale x 2 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv2f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float>)
+
+define float @vreduce_fmax_nxv4f32(<vscale x 4 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv4f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float> %v)
+  ret float %red
+}
+
+declare float @llvm.vector.reduce.fmax.nxv32f32(<vscale x 32 x float>)
+
+define float @vreduce_fmax_nxv32f32(<vscale x 32 x float> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv32f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call float @llvm.vector.reduce.fmax.nxv32f32(<vscale x 32 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call float @llvm.vector.reduce.fmax.nxv32f32(<vscale x 32 x float> %v)
+  ret float %red
+}
+
+declare double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double>)
+
+define double @vreduce_fmax_nxv1f64(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fmax_nxv1f64_nonans(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f64_nonans'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call nnan double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+define double @vreduce_fmax_nxv1f64_nonans_noinfs(<vscale x 1 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv1f64_nonans_noinfs'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call nnan ninf double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call nnan ninf double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double>)
+
+define double @vreduce_fmax_nxv2f64(<vscale x 2 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv2f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmax.nxv4f64(<vscale x 4 x double>)
+
+define double @vreduce_fmax_nxv4f64(<vscale x 4 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv4f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmax.nxv4f64(<vscale x 4 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmax.nxv4f64(<vscale x 4 x double> %v)
+  ret double %red
+}
+
+declare double @llvm.vector.reduce.fmax.nxv16f64(<vscale x 16 x double>)
+
+define double @vreduce_fmax_nxv16f64(<vscale x 16 x double> %v) {
+; CHECK-LABEL: 'vreduce_fmax_nxv16f64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call double @llvm.vector.reduce.fmax.nxv16f64(<vscale x 16 x double> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret double %red
+;
+  %red = call double @llvm.vector.reduce.fmax.nxv16f64(<vscale x 16 x double> %v)
+  ret double %red
+}
+
+define float @vreduce_nsz_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
+; CHECK-LABEL: 'vreduce_nsz_fadd_nxv1f32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call reassoc nsz float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret float %red
+;
+  %red = call reassoc nsz float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
+  ret float %red
+}

diff  --git a/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll b/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll
new file mode 100644
index 000000000000..a4fa5d94ac0c
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/RISCV/reduce-scalable-int.ll
@@ -0,0 +1,1257 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
+; RUN: opt < %s -mtriple=riscv32 -mattr=+v -passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefixes=CHECK
+; RUN: opt < %s -mtriple=riscv64 -mattr=+v -passes='print<cost-model>' -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefixes=CHECK
+
+declare i8 @llvm.vector.reduce.add.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_add_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.add.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.add.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umax.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_umax_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umax.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umax.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smax.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_smax_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smax.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smax.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umin.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_umin_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umin.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umin.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smin.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_smin_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smin.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smin.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.and.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_and_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.and.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.and.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.or.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_or_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.or.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.or.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.xor.nxv1i8(<vscale x 1 x i8>)
+
+define signext i8 @vreduce_xor_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv1i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.xor.nxv1i8(<vscale x 1 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.xor.nxv1i8(<vscale x 1 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.add.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_add_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.add.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.add.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umax.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_umax_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umax.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umax.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smax.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_smax_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smax.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smax.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umin.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_umin_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umin.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umin.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smin.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_smin_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smin.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smin.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.and.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_and_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.and.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.and.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.or.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_or_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.or.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.or.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.xor.nxv2i8(<vscale x 2 x i8>)
+
+define signext i8 @vreduce_xor_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv2i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.xor.nxv2i8(<vscale x 2 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.xor.nxv2i8(<vscale x 2 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.add.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_add_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.add.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.add.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umax.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_umax_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umax.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umax.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smax.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_smax_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smax.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smax.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.umin.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_umin_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.umin.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.umin.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.smin.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_smin_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.smin.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.smin.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.and.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_and_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.and.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.and.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.or.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_or_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.or.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.or.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i8 @llvm.vector.reduce.xor.nxv4i8(<vscale x 4 x i8>)
+
+define signext i8 @vreduce_xor_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv4i8'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i8 @llvm.vector.reduce.xor.nxv4i8(<vscale x 4 x i8> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i8 %red
+;
+  %red = call i8 @llvm.vector.reduce.xor.nxv4i8(<vscale x 4 x i8> %v)
+  ret i8 %red
+}
+
+declare i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_add_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_add_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv1i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 1 x i8> %v to <vscale x 1 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 1 x i8> %v to <vscale x 1 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %e)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_uadd_nxv1i8(<vscale x 1 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv1i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 1 x i8> %v to <vscale x 1 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 1 x i8> %v to <vscale x 1 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv1i16(<vscale x 1 x i16> %e)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umax.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_umax_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umax.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umax.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smax.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_smax_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smax.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smax.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umin.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_umin_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umin.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umin.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smin.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_smin_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smin.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smin.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.and.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_and_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.and.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.and.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.or.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_or_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.or.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.or.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.xor.nxv1i16(<vscale x 1 x i16>)
+
+define signext i16 @vreduce_xor_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv1i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.xor.nxv1i16(<vscale x 1 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.xor.nxv1i16(<vscale x 1 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_add_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_add_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv2i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 2 x i8> %v to <vscale x 2 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 2 x i8> %v to <vscale x 2 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %e)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_uadd_nxv2i8(<vscale x 2 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv2i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 2 x i8> %v to <vscale x 2 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 2 x i8> %v to <vscale x 2 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv2i16(<vscale x 2 x i16> %e)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umax.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_umax_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umax.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umax.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smax.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_smax_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smax.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smax.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umin.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_umin_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umin.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umin.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smin.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_smin_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smin.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smin.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.and.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_and_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.and.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.and.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.or.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_or_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.or.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.or.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.xor.nxv2i16(<vscale x 2 x i16>)
+
+define signext i16 @vreduce_xor_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv2i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.xor.nxv2i16(<vscale x 2 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.xor.nxv2i16(<vscale x 2 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_add_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_add_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv4i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 4 x i8> %v to <vscale x 4 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 4 x i8> %v to <vscale x 4 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %e)
+  ret i16 %red
+}
+
+define signext i16 @vwreduce_uadd_nxv4i8(<vscale x 4 x i8> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv4i8'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 4 x i8> %v to <vscale x 4 x i16>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %e = sext <vscale x 4 x i8> %v to <vscale x 4 x i16>
+  %red = call i16 @llvm.vector.reduce.add.nxv4i16(<vscale x 4 x i16> %e)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umax.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_umax_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umax.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umax.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smax.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_smax_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smax.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smax.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.umin.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_umin_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.umin.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.umin.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.smin.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_smin_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.smin.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.smin.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.and.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_and_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.and.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.and.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.or.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_or_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.or.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.or.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i16 @llvm.vector.reduce.xor.nxv4i16(<vscale x 4 x i16>)
+
+define signext i16 @vreduce_xor_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv4i16'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i16 @llvm.vector.reduce.xor.nxv4i16(<vscale x 4 x i16> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i16 %red
+;
+  %red = call i16 @llvm.vector.reduce.xor.nxv4i16(<vscale x 4 x i16> %v)
+  ret i16 %red
+}
+
+declare i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_add_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_add_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv1i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 1 x i16> %v to <vscale x 1 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = sext <vscale x 1 x i16> %v to <vscale x 1 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %e)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_uadd_nxv1i16(<vscale x 1 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv1i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 1 x i16> %v to <vscale x 1 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = zext <vscale x 1 x i16> %v to <vscale x 1 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv1i32(<vscale x 1 x i32> %e)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umax.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_umax_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umax.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umax.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smax.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_smax_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smax.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smax.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umin.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_umin_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umin.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umin.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smin.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_smin_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smin.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smin.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.and.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_and_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.and.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.and.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.or.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_or_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.or.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.or.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.xor.nxv1i32(<vscale x 1 x i32>)
+
+define signext i32 @vreduce_xor_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv1i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.xor.nxv1i32(<vscale x 1 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.xor.nxv1i32(<vscale x 1 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_add_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_add_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv2i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 2 x i16> %v to <vscale x 2 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = sext <vscale x 2 x i16> %v to <vscale x 2 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %e)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_uadd_nxv2i16(<vscale x 2 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv2i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 2 x i16> %v to <vscale x 2 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = zext <vscale x 2 x i16> %v to <vscale x 2 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv2i32(<vscale x 2 x i32> %e)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umax.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_umax_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umax.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umax.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smax.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_smax_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smax.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smax.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umin.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_umin_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umin.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umin.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smin.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_smin_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smin.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smin.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.and.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_and_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.and.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.and.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.or.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_or_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.or.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.or.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.xor.nxv2i32(<vscale x 2 x i32>)
+
+define signext i32 @vreduce_xor_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv2i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.xor.nxv2i32(<vscale x 2 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.xor.nxv2i32(<vscale x 2 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_add_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_add_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv4i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 4 x i16> %v to <vscale x 4 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = sext <vscale x 4 x i16> %v to <vscale x 4 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %e)
+  ret i32 %red
+}
+
+define signext i32 @vwreduce_uadd_nxv4i16(<vscale x 4 x i16> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv4i16'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 4 x i16> %v to <vscale x 4 x i32>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %e = zext <vscale x 4 x i16> %v to <vscale x 4 x i32>
+  %red = call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %e)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umax.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_umax_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umax.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umax.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smax.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_smax_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smax.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smax.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.umin.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_umin_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.umin.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.umin.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.smin.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_smin_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.smin.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.smin.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.and.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_and_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.and.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.and.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.or.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_or_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.or.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.or.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i32 @llvm.vector.reduce.xor.nxv4i32(<vscale x 4 x i32>)
+
+define signext i32 @vreduce_xor_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv4i32'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i32 @llvm.vector.reduce.xor.nxv4i32(<vscale x 4 x i32> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i32 %red
+;
+  %red = call i32 @llvm.vector.reduce.xor.nxv4i32(<vscale x 4 x i32> %v)
+  ret i32 %red
+}
+
+declare i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_add_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+define i64 @vwreduce_add_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv1i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 1 x i32> %v to <vscale x 1 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = sext <vscale x 1 x i32> %v to <vscale x 1 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %e)
+  ret i64 %red
+}
+
+define i64 @vwreduce_uadd_nxv1i32(<vscale x 1 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv1i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 1 x i32> %v to <vscale x 1 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = zext <vscale x 1 x i32> %v to <vscale x 1 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv1i64(<vscale x 1 x i64> %e)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umax.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_umax_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umax.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umax.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smax.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_smax_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smax.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smax.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umin.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_umin_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umin.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umin.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smin.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_smin_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smin.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smin.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.and.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_and_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.and.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.and.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.or.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_or_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.or.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.or.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.xor.nxv1i64(<vscale x 1 x i64>)
+
+define i64 @vreduce_xor_nxv1i64(<vscale x 1 x i64> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv1i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.xor.nxv1i64(<vscale x 1 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.xor.nxv1i64(<vscale x 1 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_add_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+define i64 @vwreduce_add_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv2i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 2 x i32> %v to <vscale x 2 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = sext <vscale x 2 x i32> %v to <vscale x 2 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %e)
+  ret i64 %red
+}
+
+define i64 @vwreduce_uadd_nxv2i32(<vscale x 2 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv2i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 2 x i32> %v to <vscale x 2 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = zext <vscale x 2 x i32> %v to <vscale x 2 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %e)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umax.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_umax_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umax.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umax.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smax.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_smax_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smax.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smax.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umin.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_umin_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umin.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umin.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smin.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_smin_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smin.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smin.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.and.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_and_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.and.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.and.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.or.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_or_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.or.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.or.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.xor.nxv2i64(<vscale x 2 x i64>)
+
+define i64 @vreduce_xor_nxv2i64(<vscale x 2 x i64> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv2i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.xor.nxv2i64(<vscale x 2 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.xor.nxv2i64(<vscale x 2 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_add_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_add_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+define i64 @vwreduce_add_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_add_nxv4i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = sext <vscale x 4 x i32> %v to <vscale x 4 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = sext <vscale x 4 x i32> %v to <vscale x 4 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %e)
+  ret i64 %red
+}
+
+define i64 @vwreduce_uadd_nxv4i32(<vscale x 4 x i32> %v) {
+; CHECK-LABEL: 'vwreduce_uadd_nxv4i32'
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %e = zext <vscale x 4 x i32> %v to <vscale x 4 x i64>
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %e)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %e = zext <vscale x 4 x i32> %v to <vscale x 4 x i64>
+  %red = call i64 @llvm.vector.reduce.add.nxv4i64(<vscale x 4 x i64> %e)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umax.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_umax_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umax_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umax.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umax.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smax.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_smax_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smax_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smax.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smax.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.umin.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_umin_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_umin_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.umin.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.umin.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.smin.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_smin_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_smin_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.smin.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.smin.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.and.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_and_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_and_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.and.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.and.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.or.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_or_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_or_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.or.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.or.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}
+
+declare i64 @llvm.vector.reduce.xor.nxv4i64(<vscale x 4 x i64>)
+
+define i64 @vreduce_xor_nxv4i64(<vscale x 4 x i64> %v) {
+; CHECK-LABEL: 'vreduce_xor_nxv4i64'
+; CHECK-NEXT:  Cost Model: Invalid cost for instruction: %red = call i64 @llvm.vector.reduce.xor.nxv4i64(<vscale x 4 x i64> %v)
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret i64 %red
+;
+  %red = call i64 @llvm.vector.reduce.xor.nxv4i64(<vscale x 4 x i64> %v)
+  ret i64 %red
+}


        


More information about the llvm-commits mailing list