[llvm] [RISCV] Add cost modeling for Zvzip 0.3 (PR #224991)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 02:57:36 PDT 2026
https://github.com/renndong updated https://github.com/llvm/llvm-project/pull/224991
>From 293d62071e29e5306a75e2a56c90c98977076354 Mon Sep 17 00:00:00 2001
From: Mingliang Liu <liumingliang.dev at bytedance.com>
Date: Mon, 21 Sep 2026 12:01:07 +0800
Subject: [PATCH 1/3] [RISCV] Add Zvzip cost model test
---
.../Analysis/CostModel/RISCV/shuffle-zvzip.ll | 901 ++++++++++++++++++
1 file changed, 901 insertions(+)
create mode 100644 llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
diff --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll b/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
new file mode 100644
index 0000000000000..1e4518f2372a4
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
@@ -0,0 +1,901 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output -mtriple=riscv64 -mattr=+v,+zvfh,+experimental-zvzip | FileCheck %s --check-prefix=ZVZIP
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output -mtriple=riscv64 -mattr=+v,+zvfh | FileCheck %s --check-prefix=NOZVZIP
+; RUN: opt < %s -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output -mtriple=riscv64 -mattr=+zve32f,+zvl128b,+experimental-zvzip | FileCheck %s --check-prefix=ZVE32
+
+define <32 x i8> @vzip_concat_v32i8(<16 x i8> %a, <16 x i8> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v32i8'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <16 x i8> %a, <16 x i8> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <32 x i8> %concat, <32 x i8> poison, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v32i8'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <16 x i8> %a, <16 x i8> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <32 x i8> %concat, <32 x i8> poison, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v32i8'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <16 x i8> %a, <16 x i8> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <32 x i8> %concat, <32 x i8> poison, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %res
+;
+ %concat = shufflevector <16 x i8> %a, <16 x i8> %b, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
+ %res = shufflevector <32 x i8> %concat, <32 x i8> poison, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
+ ret <32 x i8> %res
+}
+
+define <16 x i16> @vzip_concat_v16i16(<8 x i16> %a, <8 x i16> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v16i16'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <8 x i16> %a, <8 x i16> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <16 x i16> %concat, <16 x i16> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v16i16'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <8 x i16> %a, <8 x i16> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <16 x i16> %concat, <16 x i16> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v16i16'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <8 x i16> %a, <8 x i16> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <16 x i16> %concat, <16 x i16> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %res
+;
+ %concat = shufflevector <8 x i16> %a, <8 x i16> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+ %res = shufflevector <16 x i16> %concat, <16 x i16> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+ ret <16 x i16> %res
+}
+
+define <8 x i32> @vzip_concat_v8i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x i32> %res
+}
+
+define <4 x i32> @vzip_single_src_v4i32(<4 x i32> %v) {
+; ZVZIP-LABEL: 'vzip_single_src_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_single_src_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_single_src_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+ ret <4 x i32> %res
+}
+
+define <8 x i32> @vzip_2src_v8i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @vzip_2src_swapped_v8i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_swapped_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_swapped_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_swapped_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+ ret <8 x i32> %res
+}
+
+define <4 x i32> @vzip_2src_low_halves_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_low_halves_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_low_halves_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_low_halves_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+ ret <4 x i32> %res
+}
+
+define <4 x i32> @vzip_2src_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_upper_half_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_upper_half_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_upper_half_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+ ret <4 x i32> %res
+}
+
+define <4 x i32> @vzip_2src_first_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_first_upper_half_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_first_upper_half_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_first_upper_half_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+ ret <4 x i32> %res
+}
+
+define <8 x i32> @vzip_2src_poison_mask_v8i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_2src_poison_mask_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_2src_poison_mask_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_2src_poison_mask_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @non_vzip_2src_no_zero_start_v8i32(<8 x i32> %a, <8 x i32> %b) {
+; ZVZIP-LABEL: 'non_vzip_2src_no_zero_start_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 1, i32 8, i32 2, i32 9, i32 3, i32 10, i32 4, i32 11>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'non_vzip_2src_no_zero_start_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 1, i32 8, i32 2, i32 9, i32 3, i32 10, i32 4, i32 11>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'non_vzip_2src_no_zero_start_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 1, i32 8, i32 2, i32 9, i32 3, i32 10, i32 4, i32 11>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 1, i32 8, i32 2, i32 9, i32 3, i32 10, i32 4, i32 11>
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @non_vzip_unaligned_2src_v8i32(<8 x i32> %a, <8 x i32> %b) {
+; ZVZIP-LABEL: 'non_vzip_unaligned_2src_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 10, i32 2, i32 11, i32 3, i32 12>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'non_vzip_unaligned_2src_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 10, i32 2, i32 11, i32 3, i32 12>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'non_vzip_unaligned_2src_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 10, i32 2, i32 11, i32 3, i32 12>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 10, i32 2, i32 11, i32 3, i32 12>
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @non_vzip_single_src_no_zero_start_v8i32(<8 x i32> %v) {
+; ZVZIP-LABEL: 'non_vzip_single_src_no_zero_start_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 1, i32 4, i32 2, i32 5, i32 3, i32 6, i32 4, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'non_vzip_single_src_no_zero_start_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 1, i32 4, i32 2, i32 5, i32 3, i32 6, i32 4, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'non_vzip_single_src_no_zero_start_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 1, i32 4, i32 2, i32 5, i32 3, i32 6, i32 4, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 1, i32 4, i32 2, i32 5, i32 3, i32 6, i32 4, i32 7>
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @non_vzip_single_src_unaligned_v8i32(<8 x i32> %v) {
+; ZVZIP-LABEL: 'non_vzip_single_src_unaligned_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'non_vzip_single_src_unaligned_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'non_vzip_single_src_unaligned_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = shufflevector <8 x i32> %v, <8 x i32> poison, <8 x i32> <i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3, i32 4>
+ ret <8 x i32> %res
+}
+
+define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv8i32'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8i32'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv8i32'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+ %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+ ret <vscale x 8 x i32> %res
+}
+
+define <8 x i32> @vzip_intrinsic_v8i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+ ret <8 x i32> %res
+}
+
+define <8 x i32> @vzip_intrinsic_v8i32_poison(<4 x i32> %a) {
+; ZVZIP-LABEL: 'vzip_intrinsic_v8i32_poison'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> poison)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_v8i32_poison'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> poison)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_v8i32_poison'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 34 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> poison)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
+;
+ %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> poison)
+ ret <8 x i32> %res
+}
+
+define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32_poison(<vscale x 4 x i32> %a) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv8i32_poison'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> poison)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8i32_poison'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> poison)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv8i32_poison'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> poison)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
+;
+ %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> poison)
+ ret <vscale x 8 x i32> %res
+}
+
+define <8 x i64> @vzip_concat_v8i64(<4 x i64> %a, <4 x i64> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v8i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x i64> %a, <4 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v8i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x i64> %a, <4 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v8i64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %concat = shufflevector <4 x i64> %a, <4 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+ %concat = shufflevector <4 x i64> %a, <4 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x i64> %res
+}
+
+define <16 x i64> @vzip_concat_v16i64(<8 x i64> %a, <8 x i64> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v16i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %concat = shufflevector <8 x i64> %a, <8 x i64> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v16i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %concat = shufflevector <8 x i64> %a, <8 x i64> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v16i64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %concat = shufflevector <8 x i64> %a, <8 x i64> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
+;
+ %concat = shufflevector <8 x i64> %a, <8 x i64> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+ %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+ ret <16 x i64> %res
+}
+
+define <vscale x 16 x i64> @vzip_intrinsic_nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv16i64'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 16 x i64> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv16i64'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 16 x i64> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv16i64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 16 x i64> %res
+;
+ %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
+ ret <vscale x 16 x i64> %res
+}
+
+define <8 x half> @vzip_concat_v8f16(<4 x half> %a, <4 x half> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v8f16'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %concat = shufflevector <4 x half> %a, <4 x half> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x half> %concat, <8 x half> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x half> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v8f16'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %concat = shufflevector <4 x half> %a, <4 x half> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x half> %concat, <8 x half> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x half> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v8f16'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %concat = shufflevector <4 x half> %a, <4 x half> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x half> %concat, <8 x half> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x half> %res
+;
+ %concat = shufflevector <4 x half> %a, <4 x half> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %res = shufflevector <8 x half> %concat, <8 x half> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x half> %res
+}
+
+define <vscale x 8 x half> @vzip_intrinsic_nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv8f16'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x half> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8f16'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x half> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv8f16'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x half> %res
+;
+ %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
+ ret <vscale x 8 x half> %res
+}
+
+define <8 x float> @vzip_concat_v8f32(<4 x float> %a, <4 x float> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v8f32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v8f32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v8f32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %res
+;
+ %concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x float> %res
+}
+
+define <vscale x 8 x float> @vzip_intrinsic_nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv8f32'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8f32'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv8f32'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
+;
+ %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+ ret <vscale x 8 x float> %res
+}
+
+define <8 x double> @vzip_concat_v8f64(<4 x double> %a, <4 x double> %b) {
+; ZVZIP-LABEL: 'vzip_concat_v8f64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x double> %a, <4 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x double> %res
+;
+; NOZVZIP-LABEL: 'vzip_concat_v8f64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x double> %a, <4 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x double> %res
+;
+; ZVE32-LABEL: 'vzip_concat_v8f64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %concat = shufflevector <4 x double> %a, <4 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x double> %res
+;
+ %concat = shufflevector <4 x double> %a, <4 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
+ %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+ ret <8 x double> %res
+}
+
+define <vscale x 4 x double> @vzip_intrinsic_nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
+; ZVZIP-LABEL: 'vzip_intrinsic_nxv4f64'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 4 x double> %res
+;
+; NOZVZIP-LABEL: 'vzip_intrinsic_nxv4f64'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 4 x double> %res
+;
+; ZVE32-LABEL: 'vzip_intrinsic_nxv4f64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 4 x double> %res
+;
+ %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
+ ret <vscale x 4 x double> %res
+}
+
+define <2 x i32> @deinterleave_v2i32(<4 x i32> %v) {
+; ZVZIP-LABEL: 'deinterleave_v2i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
+;
+; NOZVZIP-LABEL: 'deinterleave_v2i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
+;
+; ZVE32-LABEL: 'deinterleave_v2i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
+;
+ %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
+ ret <2 x i32> %res
+}
+
+define <4 x i32> @deinterleave_even_v4i32(<8 x i32> %v) {
+; ZVZIP-LABEL: 'deinterleave_even_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'deinterleave_even_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'deinterleave_even_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+ ret <4 x i32> %res
+}
+
+define <4 x i32> @deinterleave_odd_v4i32(<8 x i32> %v) {
+; ZVZIP-LABEL: 'deinterleave_odd_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'deinterleave_odd_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'deinterleave_odd_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+ ret <4 x i32> %res
+}
+
+define { <vscale x 4 x i32>, <vscale x 4 x i32> } @vunzip_intrinsic_nxv8i32(<vscale x 8 x i32> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8i32'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8i32'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_nxv8i32'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
+;
+ %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+ ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
+}
+
+define { <4 x i32>, <4 x i32> } @vunzip_intrinsic_v8i32(<8 x i32> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_v8i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 39 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_v8i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 39 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_v8i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 39 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
+;
+ %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+ ret { <4 x i32>, <4 x i32> } %res
+}
+
+define <1 x i64> @deinterleave_v1i64(<2 x i64> %v) {
+; ZVZIP-LABEL: 'deinterleave_v1i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <2 x i64> %v, <2 x i64> poison, <1 x i32> zeroinitializer
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <1 x i64> %res
+;
+; NOZVZIP-LABEL: 'deinterleave_v1i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <2 x i64> %v, <2 x i64> poison, <1 x i32> zeroinitializer
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <1 x i64> %res
+;
+; ZVE32-LABEL: 'deinterleave_v1i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <2 x i64> %v, <2 x i64> poison, <1 x i32> zeroinitializer
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <1 x i64> %res
+;
+ %res = shufflevector <2 x i64> %v, <2 x i64> poison, <1 x i32> zeroinitializer
+ ret <1 x i64> %res
+}
+
+define <4 x i64> @vunzipe_v4i64(<8 x i64> %v) {
+; ZVZIP-LABEL: 'vunzipe_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'vunzipe_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'vunzipe_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+ ret <4 x i64> %res
+}
+
+define <4 x i64> @vunzipo_v4i64(<8 x i64> %v) {
+; ZVZIP-LABEL: 'vunzipo_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'vunzipo_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'vunzipo_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+ ret <4 x i64> %res
+}
+
+define <4 x i64> @vunzipe_poison_mask_v4i64(<8 x i64> %v) {
+; ZVZIP-LABEL: 'vunzipe_poison_mask_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'vunzipe_poison_mask_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'vunzipe_poison_mask_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
+ ret <4 x i64> %res
+}
+
+define <4 x i64> @non_vunzip_single_defined_v4i64(<8 x i64> %v) {
+; ZVZIP-LABEL: 'non_vunzip_single_defined_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'non_vunzip_single_defined_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'non_vunzip_single_defined_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
+ ret <4 x i64> %res
+}
+
+define { <4 x i64>, <4 x i64> } @vunzip_intrinsic_v8i64(<8 x i64> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_v8i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_v8i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_v8i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
+;
+ %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+ ret { <4 x i64>, <4 x i64> } %res
+}
+
+define <8 x i64> @vunzipe_v8i64(<16 x i64> %v) {
+; ZVZIP-LABEL: 'vunzipe_v8i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+; NOZVZIP-LABEL: 'vunzipe_v8i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+; ZVE32-LABEL: 'vunzipe_v8i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
+;
+ %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+ ret <8 x i64> %res
+}
+
+define { <vscale x 8 x i64>, <vscale x 8 x i64> } @vunzip_intrinsic_nxv16i64(<vscale x 16 x i64> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_nxv16i64'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 8 x i64>, <vscale x 8 x i64> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv16i64'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 8 x i64>, <vscale x 8 x i64> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_nxv16i64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 8 x i64>, <vscale x 8 x i64> } %res
+;
+ %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
+ ret { <vscale x 8 x i64>, <vscale x 8 x i64> } %res
+}
+
+define { <vscale x 4 x half>, <vscale x 4 x half> } @vunzip_intrinsic_nxv8f16(<vscale x 8 x half> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8f16'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x half>, <vscale x 4 x half> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8f16'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x half>, <vscale x 4 x half> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_nxv8f16'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x half>, <vscale x 4 x half> } %res
+;
+ %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
+ ret { <vscale x 4 x half>, <vscale x 4 x half> } %res
+}
+
+define { <vscale x 4 x float>, <vscale x 4 x float> } @vunzip_intrinsic_nxv8f32(<vscale x 8 x float> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8f32'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8f32'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_nxv8f32'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
+;
+ %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+ ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
+}
+
+define { <vscale x 2 x double>, <vscale x 2 x double> } @vunzip_intrinsic_nxv4f64(<vscale x 4 x double> %v) {
+; ZVZIP-LABEL: 'vunzip_intrinsic_nxv4f64'
+; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 2 x double>, <vscale x 2 x double> } %res
+;
+; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv4f64'
+; NOZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 2 x double>, <vscale x 2 x double> } %res
+;
+; ZVE32-LABEL: 'vunzip_intrinsic_nxv4f64'
+; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 2 x double>, <vscale x 2 x double> } %res
+;
+ %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
+ ret { <vscale x 2 x double>, <vscale x 2 x double> } %res
+}
+
+define <4 x i32> @vpaire_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vpaire_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vpaire_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vpaire_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+ ret <4 x i32> %res
+}
+
+define <4 x i32> @vpairo_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vpairo_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vpairo_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vpairo_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+ ret <4 x i32> %res
+}
+
+define <4 x i64> @vpaire_v4i64(<4 x i64> %a, <4 x i64> %b) {
+; ZVZIP-LABEL: 'vpaire_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'vpaire_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'vpaire_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+ ret <4 x i64> %res
+}
+
+define <4 x i64> @vpairo_v4i64(<4 x i64> %a, <4 x i64> %b) {
+; ZVZIP-LABEL: 'vpairo_v4i64'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; NOZVZIP-LABEL: 'vpairo_v4i64'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+; ZVE32-LABEL: 'vpairo_v4i64'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
+;
+ %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+ ret <4 x i64> %res
+}
+
+define <8 x i1> @vpaire_v8i1(<8 x i1> %a, <8 x i1> %b) {
+; ZVZIP-LABEL: 'vpaire_v8i1'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i1> %a, <8 x i1> %b, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i1> %res
+;
+; NOZVZIP-LABEL: 'vpaire_v8i1'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i1> %a, <8 x i1> %b, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i1> %res
+;
+; ZVE32-LABEL: 'vpaire_v8i1'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i1> %a, <8 x i1> %b, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i1> %res
+;
+ %res = shufflevector <8 x i1> %a, <8 x i1> %b, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14>
+ ret <8 x i1> %res
+}
+
+define <4 x i32> @vpaire_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vpaire_swapped_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vpaire_swapped_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vpaire_swapped_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+ ret <4 x i32> %res
+}
+
+define <4 x i32> @vpairo_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
+; ZVZIP-LABEL: 'vpairo_swapped_v4i32'
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; NOZVZIP-LABEL: 'vpairo_swapped_v4i32'
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+; ZVE32-LABEL: 'vpairo_swapped_v4i32'
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
+;
+ %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+ ret <4 x i32> %res
+}
+
+declare <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32>, <vscale x 4 x i32>)
+declare <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32>, <4 x i32>)
+declare <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64>, <vscale x 8 x i64>)
+declare <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half>, <vscale x 4 x half>)
+declare <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float>, <vscale x 4 x float>)
+declare <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double>, <vscale x 2 x double>)
+
+declare { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32>)
+declare { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32>)
+declare { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64>)
+declare { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64>)
+declare { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half>)
+declare { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float>)
+declare { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double>)
>From c3944c08500e951f412b70db6c95b67916992e86 Mon Sep 17 00:00:00 2001
From: Mingliang Liu <liumingliang.dev at bytedance.com>
Date: Mon, 21 Sep 2026 12:36:59 +0800
Subject: [PATCH 2/3] [RISCV] Add cost modeling for Zvzip 0.3
Teach the RISC-V TTI to recognize interleave, deinterleave, and
pair-even/pair-odd shuffles that can be implemented with vzip.vv,
vunzipe[o].v, or vpaire[o].v. Also add target-specific costs for
llvm.vector.interleave2 and llvm.vector.deinterleave2 intrinsics.
Move the pair-even and pair-odd shuffle mask matchers to VectorUtils so
they can be shared by instruction selection and the cost model, and use
them to model vpaire.vv and vpairo.vv.
Assisted-By: Trae CLI (GPT-5)
---
llvm/include/llvm/Analysis/VectorUtils.h | 20 ++
llvm/lib/Analysis/VectorUtils.cpp | 41 ++++
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 52 +---
.../Target/RISCV/RISCVTargetTransformInfo.cpp | 222 ++++++++++++++++++
.../Target/RISCV/RISCVTargetTransformInfo.h | 6 +
.../Analysis/CostModel/RISCV/shuffle-zvzip.ll | 114 ++++-----
6 files changed, 348 insertions(+), 107 deletions(-)
diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h
index b177d9eec2189..edd15000def14 100644
--- a/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/llvm/include/llvm/Analysis/VectorUtils.h
@@ -229,6 +229,26 @@ LLVM_ABI bool getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
LLVM_ABI bool isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
std::array<std::pair<int, int>, 2> &SrcInfo);
+/// Given a shuffle which can be represented as a pair of two slides, return
+/// true if it is a pair-even idiom and set \p Factor to its pairing factor.
+/// The mappings in \p SrcInfo may be in either order.
+/// Pair-even is:
+/// Input 0: a0 a1 a2 a3
+/// Input 1: b0 b1 b2 b3
+/// Result: a0 b0 a2 b2
+LLVM_ABI bool isPairEvenShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor);
+
+/// Given a shuffle which can be represented as a pair of two slides, return
+/// true if it is a pair-odd idiom and set \p Factor to its pairing factor.
+/// The mappings in \p SrcInfo may be in either order.
+/// Pair-odd is:
+/// Input 0: a0 a1 a2 a3
+/// Input 1: b0 b1 b2 b3
+/// Result: a1 b1 a3 b3
+LLVM_ABI bool isPairOddShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor);
+
/// Replace each shuffle mask index with the scaled sequential indices for an
/// equivalent mask of narrowed elements. Mask elements that are less than 0
/// (sentinel values) are repeated in the output mask.
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp
index 1c105ebb772b3..f5a2f1ae6fe1c 100644
--- a/llvm/lib/Analysis/VectorUtils.cpp
+++ b/llvm/lib/Analysis/VectorUtils.cpp
@@ -513,6 +513,47 @@ bool llvm::isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
return SrcInfo[0].first != -1;
}
+static bool
+isAlternatingShuffleMask(const std::array<std::pair<int, int>, 2> &SrcInfo,
+ ArrayRef<int> Mask, unsigned Factor,
+ bool RequiredPolarity) {
+ int NumElts = Mask.size();
+ for (const auto &[Idx, M] : enumerate(Mask)) {
+ if (M < 0)
+ continue;
+ int Src = M >= NumElts;
+ int Diff = static_cast<int>(Idx) - (M % NumElts);
+ bool C = Src == SrcInfo[1].first && Diff == SrcInfo[1].second;
+ assert(C != (Src == SrcInfo[0].first && Diff == SrcInfo[0].second) &&
+ "Must match exactly one of the two slides");
+ if (RequiredPolarity != (C == (Idx / Factor) % 2))
+ return false;
+ }
+ return true;
+}
+
+bool llvm::isPairEvenShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor) {
+ if (SrcInfo[1].second == 0)
+ std::swap(SrcInfo[0], SrcInfo[1]);
+
+ Factor = SrcInfo[1].second;
+ return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
+ Mask.size() % Factor == 0 &&
+ isAlternatingShuffleMask(SrcInfo, Mask, Factor, true);
+}
+
+bool llvm::isPairOddShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor) {
+ if (SrcInfo[1].second == 0)
+ std::swap(SrcInfo[0], SrcInfo[1]);
+
+ Factor = -SrcInfo[1].second;
+ return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
+ Mask.size() % Factor == 0 &&
+ isAlternatingShuffleMask(SrcInfo, Mask, Factor, false);
+}
+
void llvm::narrowShuffleMaskElts(int Scale, ArrayRef<int> Mask,
SmallVectorImpl<int> &ScaledMask) {
assert(Scale > 0 && "Unexpected scaling factor");
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 2c05e3000c5eb..5b7a93052d65c 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -5490,54 +5490,6 @@ static bool isElementRotate(const std::array<std::pair<int, int>, 2> &SrcInfo,
SrcInfo[1].second - SrcInfo[0].second == (int)NumElts;
}
-static bool isAlternating(const std::array<std::pair<int, int>, 2> &SrcInfo,
- ArrayRef<int> Mask, unsigned Factor,
- bool RequiredPolarity) {
- int NumElts = Mask.size();
- for (const auto &[Idx, M] : enumerate(Mask)) {
- if (M < 0)
- continue;
- int Src = M >= NumElts;
- int Diff = (int)Idx - (M % NumElts);
- bool C = Src == SrcInfo[1].first && Diff == SrcInfo[1].second;
- assert(C != (Src == SrcInfo[0].first && Diff == SrcInfo[0].second) &&
- "Must match exactly one of the two slides");
- if (RequiredPolarity != (C == (Idx / Factor) % 2))
- return false;
- }
- return true;
-}
-
-/// Given a shuffle which can be represented as a pair of two slides,
-/// see if it is a pair-even idiom.
-/// Pair-even is:
-/// vs2: a0 a1 a2 a3
-/// vs1: b0 b1 b2 b3
-/// vd: a0 b0 a2 b2
-static bool isPairEven(const std::array<std::pair<int, int>, 2> &SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor) {
- Factor = SrcInfo[1].second;
- return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
- Mask.size() % Factor == 0 &&
- isAlternating(SrcInfo, Mask, Factor, true);
-}
-
-/// Given a shuffle which can be represented as a pair of two slides,
-/// see if it is a pair-odd idiom.
-/// Pair-odd is:
-/// vs2: a0 a1 a2 a3
-/// vs1: b0 b1 b2 b3
-/// vd: a1 b1 a3 b3
-/// Note that the operand order is swapped due to the way we canonicalize
-/// the slides, so SrCInfo[0] is vs1, and SrcInfo[1] is vs2.
-static bool isPairOdd(const std::array<std::pair<int, int>, 2> &SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor) {
- Factor = -SrcInfo[1].second;
- return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
- Mask.size() % Factor == 0 &&
- isAlternating(SrcInfo, Mask, Factor, false);
-}
-
// Lower a deinterleave shuffle to SRL and TRUNC. Factor must be
// 2, 4, 8 and the integer type Factor-times larger than VT's
// element type must be a legal element type.
@@ -7039,7 +6991,7 @@ SDValue RISCVTargetLowering::lowerVECTOR_SHUFFLE(SDValue Op,
if (Subtarget.hasStdExtZvzip()) {
bool TryWiden = false;
unsigned Factor;
- if (isPairEven(SrcInfo, Mask, Factor)) {
+ if (isPairEvenShuffleMask(SrcInfo, Mask, Factor)) {
if (Factor == 1) {
SDValue Src1 = SrcInfo[0].first == 0 ? V1 : V2;
SDValue Src2 = SrcInfo[1].first == 0 ? V1 : V2;
@@ -7048,7 +7000,7 @@ SDValue RISCVTargetLowering::lowerVECTOR_SHUFFLE(SDValue Op,
}
TryWiden = true;
}
- if (isPairOdd(SrcInfo, Mask, Factor)) {
+ if (isPairOddShuffleMask(SrcInfo, Mask, Factor)) {
if (Factor == 1) {
SDValue Src1 = SrcInfo[1].first == 0 ? V1 : V2;
SDValue Src2 = SrcInfo[0].first == 0 ? V1 : V2;
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 43b4791998d39..0bcff20e4f84b 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -708,6 +708,14 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
if (SrcInfo[1].second == 0)
std::swap(SrcInfo[0], SrcInfo[1]);
+ if (ST->hasStdExtZvzip() && LT.second.getScalarSizeInBits() != 1) {
+ unsigned Factor;
+ if (isPairEvenShuffleMask(SrcInfo, Mask, Factor) && Factor == 1)
+ return getRISCVInstructionCost(RISCV::VPAIRE_VV, LT.second, CostKind);
+ if (isPairOddShuffleMask(SrcInfo, Mask, Factor) && Factor == 1)
+ return getRISCVInstructionCost(RISCV::VPAIRO_VV, LT.second, CostKind);
+ }
+
InstructionCost FirstSlideCost = 0;
if (SrcInfo[0].second != 0) {
unsigned Opcode = GetSlideOpcode(SrcInfo[0].second);
@@ -733,6 +741,149 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
return FirstSlideCost + SecondSlideCost + MaskCost;
}
+/// Return the type used to cost vzip.vv, whose LMUL represents the
+/// interleaved destination EMUL. Return std::nullopt if illegal.
+static std::optional<MVT> getZvzipVZIPCostVT(MVT InterleavedVT,
+ const RISCVSubtarget &ST,
+ const RISCVTargetLowering &TLI) {
+ if (!InterleavedVT.getVectorElementCount().isKnownEven())
+ return std::nullopt;
+
+ MVT CostVT = InterleavedVT;
+ if (InterleavedVT.isFixedLengthVector()) {
+ MVT SourceVT = InterleavedVT.getHalfNumVectorElementsVT();
+ CostVT = TLI.getContainerForFixedLengthVector(SourceVT)
+ .getDoubleNumVectorElementsVT();
+ }
+
+ unsigned EltBits = CostVT.getScalarSizeInBits();
+ unsigned MinSize = CostVT.getSizeInBits().getKnownMinValue();
+ unsigned LMULOctuple = MinSize / (RISCV::RVVBitsPerBlock / 8);
+ // Perform the 2 * SEW <= LMUL * min(ELEN, VLEN) check.
+ if (EltBits * 16 > LMULOctuple * std::min(ST.getELen(), ST.getRealMinVLen()))
+ return std::nullopt;
+ return CostVT;
+}
+
+/// Return the type used to cost vunzipe.v/vunzipo.v, whose LMUL represents
+/// the interleaved source EMUL. Return std::nullopt if illegal.
+static std::optional<MVT> getZvzipVUNZIPCostVT(MVT InterleavedVT,
+ const RISCVTargetLowering &TLI) {
+ if (!InterleavedVT.getVectorElementCount().isKnownEven())
+ return std::nullopt;
+
+ MVT CostVT = InterleavedVT;
+ // lowerZvzipVUNZIP widens the source container if halving it would produce
+ // an illegal result type. Apply the same rule here so the cost uses the
+ // source LMUL selected by ISel.
+ if (InterleavedVT.isFixedLengthVector()) {
+ CostVT = TLI.getContainerForFixedLengthVector(InterleavedVT);
+ if (CostVT.getVectorMinNumElements() == 1 ||
+ !TLI.isTypeLegal(CostVT.getHalfNumVectorElementsVT()))
+ CostVT = CostVT.getDoubleNumVectorElementsVT();
+ }
+
+ MVT DeinterleavedVT = CostVT.getHalfNumVectorElementsVT();
+ if (RISCVTargetLowering::getLMUL(DeinterleavedVT) == RISCVVType::LMUL_8)
+ return std::nullopt;
+ return CostVT;
+}
+
+InstructionCost RISCVTTIImpl::getVZIPCost(TTI::ShuffleKind Kind,
+ VectorType *DstTy, VectorType *SrcTy,
+ ArrayRef<int> Mask,
+ TTI::TargetCostKind CostKind) const {
+ if (!ST->hasStdExtZvzip() || Mask.size() < 2 ||
+ DstTy->getScalarSizeInBits() == 1)
+ return InstructionCost::getInvalid();
+
+ unsigned NumSrcElts = SrcTy->getElementCount().getKnownMinValue();
+ unsigned NumDstElts = DstTy->getElementCount().getKnownMinValue();
+ unsigned NumInputElts;
+
+ if (Kind == TTI::SK_PermuteSingleSrc) {
+ // A single-source vzip shuffle interleaves two halves of the same vector,
+ // so its source and destination must have the same number of elements.
+ if (NumSrcElts != NumDstElts)
+ return InstructionCost::getInvalid();
+ NumInputElts = NumSrcElts;
+ } else if (Kind == TTI::SK_PermuteTwoSrc) {
+ // Accept both forms that can be lowered with vzip.vv:
+ //
+ // 1. The destination has twice as many elements as each source, e.g.
+ // %r = shufflevector <4 x i32> %a, <4 x i32> %b,
+ // <8 x i32> <0, 4, 1, 5, 2, 6, 3, 7>
+ // The two operands are already the half-sized inputs of vzip.vv.
+ //
+ // 2. Each source has the same number of elements as the destination, e.g.
+ // %r = shufflevector <4 x i32> %a, <4 x i32> %b,
+ // <4 x i32> <0, 4, 1, 5>
+ // ISel first extracts a <2 x i32> half from each source and then uses
+ // those halves as the inputs of vzip.vv.
+ if (NumSrcElts != NumDstElts && NumSrcElts * 2 != NumDstElts)
+ return InstructionCost::getInvalid();
+ NumInputElts = NumSrcElts * 2;
+ } else {
+ return InstructionCost::getInvalid();
+ }
+
+ // ISel deliberately excludes the two-element single-source identity case.
+ if (Kind == TTI::SK_PermuteSingleSrc && Mask.size() == 2 &&
+ ShuffleVectorInst::isSingleSourceMask(Mask, Mask.size()))
+ return InstructionCost::getInvalid();
+
+ // A deinterleave shuffle for an interleaved load may have a mask such as
+ // %even = shufflevector <4 x i32> %wide, <4 x i32> poison,
+ // <4 x i32> <i32 0, i32 2, i32 poison, i32 poison>
+ // Because isInterleaveMask ignores poison lanes, this mask may also satisfy
+ // the interleave matcher. Do not cost it as vzip.vv.
+ unsigned DeinterleaveIndex;
+ if (ShuffleVectorInst::isDeInterleaveMaskOfFactor(Mask, 2,
+ DeinterleaveIndex) &&
+ count_if(Mask, [](int Idx) { return Idx >= 0; }) > 1)
+ return InstructionCost::getInvalid();
+
+ // Require the two start indices found in the mask to be aligned to
+ // half-vector boundaries, with at least one equal to zero.
+ SmallVector<unsigned, 2> StartIndexes;
+ if (!ShuffleVectorInst::isInterleaveMask(Mask, 2, NumInputElts, StartIndexes))
+ return InstructionCost::getInvalid();
+
+ unsigned HalfNumElts = Mask.size() / 2;
+ if ((StartIndexes[0] != 0 && StartIndexes[1] != 0) ||
+ StartIndexes[0] % HalfNumElts != 0 || StartIndexes[1] % HalfNumElts != 0)
+ return InstructionCost::getInvalid();
+
+ std::pair<InstructionCost, MVT> DstLT = getTypeLegalizationCost(DstTy);
+ if (!DstLT.second.isFixedLengthVector())
+ return InstructionCost::getInvalid();
+
+ std::optional<MVT> CostVT = getZvzipVZIPCostVT(DstLT.second, *ST, *TLI);
+ if (!CostVT)
+ return InstructionCost::getInvalid();
+
+ InstructionCost Cost =
+ DstLT.first * getRISCVInstructionCost(RISCV::VZIP_VV, *CostVT, CostKind);
+
+ // For a shuffle such as
+ // %r = shufflevector <4 x i32> %v, <4 x i32> poison,
+ // <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+ // vzip.vv needs two <2 x i32> inputs. Include the cost of extracting each
+ // upper half; extracting a low half is free.
+ if (NumSrcElts == NumDstElts) {
+ auto *HalfSrcTy = FixedVectorType::getHalfElementsVectorType(
+ cast<FixedVectorType>(SrcTy));
+ for (unsigned Start : StartIndexes) {
+ unsigned ExtractIndex = Start % NumSrcElts;
+ if (ExtractIndex != 0)
+ Cost += getShuffleCost(TTI::SK_ExtractSubvector, HalfSrcTy, SrcTy,
+ CostKind, {}, ExtractIndex, HalfSrcTy);
+ }
+ }
+
+ return Cost;
+}
+
InstructionCost
RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
VectorType *SrcTy, TTI::TargetCostKind CostKind,
@@ -771,6 +922,14 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
case TTI::SK_PermuteSingleSrc: {
if (Mask.size() >= 2) {
MVT EltTp = LT.second.getVectorElementType();
+
+ // Try the vzip.vv cost first, otherwise use the widening-interleave
+ // cost below.
+ if (InstructionCost VZipCost =
+ getVZIPCost(Kind, DstTy, SrcTy, Mask, CostKind);
+ VZipCost.isValid())
+ return VZipCost;
+
// If the size of the element is < ELEN then shuffles of interleaves and
// deinterleaves of 2 vectors can be lowered into the following
// sequences
@@ -792,6 +951,16 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
LT.second, CostKind);
}
}
+
+ unsigned Index;
+ if (ST->hasStdExtZvzip() && EltTp.getScalarSizeInBits() != 1 &&
+ ShuffleVectorInst::isDeInterleaveMaskOfFactor(Mask, 2, Index)) {
+ unsigned Opcode = Index == 0 ? RISCV::VUNZIPE_V : RISCV::VUNZIPO_V;
+ if (auto CostVT = getZvzipVUNZIPCostVT(LT.second, *TLI))
+ return LT.first *
+ getRISCVInstructionCost(Opcode, *CostVT, CostKind);
+ }
+
int SubVectorSize;
if (LT.second.getScalarSizeInBits() != 1 &&
isRepeatedConcatMask(Mask, SubVectorSize)) {
@@ -840,6 +1009,10 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
SlideCost.isValid())
return SlideCost;
+ if (InstructionCost VZipCost =
+ getVZIPCost(Kind, DstTy, SrcTy, Mask, CostKind);
+ VZipCost.isValid())
+ return VZipCost;
// 2 x (vrgather + cost of generating the mask constant) + cost of mask
// register for the second vrgather. We model this for an unknown
// (shuffle) mask.
@@ -1897,6 +2070,55 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
ValLT.second, CostKind);
return Cost;
}
+ case Intrinsic::vector_interleave2:
+ case Intrinsic::vector_deinterleave2: {
+ if (!ST->hasStdExtZvzip())
+ break;
+
+ bool IsInterleave = ICA.getID() == Intrinsic::vector_interleave2;
+ Type *InterleavedTy = IsInterleave ? RetTy : ICA.getArgTypes().front();
+ // ISel does not select vzip.vv if either interleave2 input is undef.
+ if (IsInterleave && !ICA.isTypeBasedOnly() &&
+ any_of(ICA.getArgs(),
+ [](const Value *Arg) { return isa<UndefValue>(Arg); }))
+ break;
+ if (InterleavedTy->getScalarSizeInBits() == 1)
+ break;
+
+ if (FixedVectorType *FVT = dyn_cast<FixedVectorType>(InterleavedTy)) {
+ if (IsInterleave) {
+ unsigned VF = FVT->getNumElements() / 2;
+ FixedVectorType *HalfFVT =
+ FixedVectorType::getHalfElementsVectorType(FVT);
+ return getShuffleCost(TTI::SK_PermuteTwoSrc, FVT, HalfFVT, CostKind,
+ createInterleaveMask(VF, 2), 0, nullptr);
+ }
+
+ FixedVectorType *HalfFVT =
+ FixedVectorType::getHalfElementsVectorType(FVT);
+ unsigned VF = HalfFVT->getNumElements();
+ InstructionCost Cost = 0;
+ for (unsigned Start = 0; Start != 2; ++Start)
+ Cost += getShuffleCost(TTI::SK_PermuteSingleSrc, HalfFVT, FVT, CostKind,
+ createStrideMask(Start, 2, VF), 0, nullptr);
+ return Cost;
+ }
+
+ std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(InterleavedTy);
+ if (!LT.second.isScalableVector())
+ break;
+ if (IsInterleave) {
+ if (std::optional<MVT> CostVT = getZvzipVZIPCostVT(LT.second, *ST, *TLI))
+ return LT.first *
+ getRISCVInstructionCost(RISCV::VZIP_VV, *CostVT, CostKind);
+ } else if (std::optional<MVT> CostVT =
+ getZvzipVUNZIPCostVT(LT.second, *TLI)) {
+ return LT.first *
+ getRISCVInstructionCost({RISCV::VUNZIPE_V, RISCV::VUNZIPO_V},
+ *CostVT, CostKind);
+ }
+ break;
+ }
}
if (ST->hasVInstructions() && RetTy->isVectorTy()) {
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 4523ebd6ae892..5f5306fc2afbf 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -72,6 +72,12 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
InstructionCost getSlideCost(FixedVectorType *Tp, ArrayRef<int> Mask,
TTI::TargetCostKind CostKind) const;
+ /// If a fixed-length shuffle can be lowered to a vzip.vv instruction,
+ /// return its cost.
+ InstructionCost getVZIPCost(TTI::ShuffleKind Kind, VectorType *DstTy,
+ VectorType *SrcTy, ArrayRef<int> Mask,
+ TTI::TargetCostKind CostKind) const;
+
public:
explicit RISCVTTIImpl(const RISCVTargetMachine *TM, const Function &F)
: BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
diff --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll b/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
index 1e4518f2372a4..6af48273cfdf0 100644
--- a/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
+++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-zvzip.ll
@@ -58,7 +58,7 @@ define <8 x i32> @vzip_concat_v8i32(<4 x i32> %a, <4 x i32> %b) {
;
; ZVE32-LABEL: 'vzip_concat_v8i32'
; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
%concat = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
@@ -76,7 +76,7 @@ define <4 x i32> @vzip_single_src_v4i32(<4 x i32> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vzip_single_src_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %v, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
@@ -85,7 +85,7 @@ define <4 x i32> @vzip_single_src_v4i32(<4 x i32> %v) {
define <8 x i32> @vzip_2src_v8i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_v8i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_v8i32'
@@ -93,7 +93,7 @@ define <8 x i32> @vzip_2src_v8i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_v8i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
@@ -102,7 +102,7 @@ define <8 x i32> @vzip_2src_v8i32(<4 x i32> %a, <4 x i32> %b) {
define <8 x i32> @vzip_2src_swapped_v8i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_swapped_v8i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_swapped_v8i32'
@@ -110,7 +110,7 @@ define <8 x i32> @vzip_2src_swapped_v8i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_swapped_v8i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 4, i32 0, i32 5, i32 1, i32 6, i32 2, i32 7, i32 3>
@@ -119,7 +119,7 @@ define <8 x i32> @vzip_2src_swapped_v8i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @vzip_2src_low_halves_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_low_halves_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_low_halves_v4i32'
@@ -127,7 +127,7 @@ define <4 x i32> @vzip_2src_low_halves_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_low_halves_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
@@ -136,7 +136,7 @@ define <4 x i32> @vzip_2src_low_halves_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @vzip_2src_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_upper_half_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_upper_half_v4i32'
@@ -144,7 +144,7 @@ define <4 x i32> @vzip_2src_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_upper_half_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 1, i32 7>
@@ -153,7 +153,7 @@ define <4 x i32> @vzip_2src_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @vzip_2src_first_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_first_upper_half_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_first_upper_half_v4i32'
@@ -161,7 +161,7 @@ define <4 x i32> @vzip_2src_first_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_first_upper_half_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 0, i32 7, i32 1>
@@ -170,7 +170,7 @@ define <4 x i32> @vzip_2src_first_upper_half_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <8 x i32> @vzip_2src_poison_mask_v8i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_2src_poison_mask_v8i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_2src_poison_mask_v8i32'
@@ -178,7 +178,7 @@ define <8 x i32> @vzip_2src_poison_mask_v8i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; ZVE32-LABEL: 'vzip_2src_poison_mask_v8i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 poison, i32 6, i32 3, i32 7>
@@ -255,7 +255,7 @@ define <8 x i32> @non_vzip_single_src_unaligned_v8i32(<8 x i32> %v) {
define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_nxv8i32'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8i32'
@@ -263,7 +263,7 @@ define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32(<vscale x 4 x i32> %a, <vscale
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
;
; ZVE32-LABEL: 'vzip_intrinsic_nxv8i32'
-; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x i32> %res
;
%res = call <vscale x 8 x i32> @llvm.vector.interleave2.nxv8i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b)
@@ -272,7 +272,7 @@ define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32(<vscale x 4 x i32> %a, <vscale
define <8 x i32> @vzip_intrinsic_v8i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_v8i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_v8i32'
@@ -280,7 +280,7 @@ define <8 x i32> @vzip_intrinsic_v8i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
; ZVE32-LABEL: 'vzip_intrinsic_v8i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res
;
%res = call <8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> %a, <4 x i32> %b)
@@ -324,7 +324,7 @@ define <vscale x 8 x i32> @vzip_intrinsic_nxv8i32_poison(<vscale x 4 x i32> %a)
define <8 x i64> @vzip_concat_v8i64(<4 x i64> %a, <4 x i64> %b) {
; ZVZIP-LABEL: 'vzip_concat_v8i64'
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x i64> %a, <4 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
;
; NOZVZIP-LABEL: 'vzip_concat_v8i64'
@@ -345,7 +345,7 @@ define <8 x i64> @vzip_concat_v8i64(<4 x i64> %a, <4 x i64> %b) {
define <16 x i64> @vzip_concat_v16i64(<8 x i64> %a, <8 x i64> %b) {
; ZVZIP-LABEL: 'vzip_concat_v16i64'
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %concat = shufflevector <8 x i64> %a, <8 x i64> %b, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %res = shufflevector <16 x i64> %concat, <16 x i64> poison, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i64> %res
;
; NOZVZIP-LABEL: 'vzip_concat_v16i64'
@@ -365,7 +365,7 @@ define <16 x i64> @vzip_concat_v16i64(<8 x i64> %a, <8 x i64> %b) {
define <vscale x 16 x i64> @vzip_intrinsic_nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_nxv16i64'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %res = call <vscale x 16 x i64> @llvm.vector.interleave2.nxv16i64(<vscale x 8 x i64> %a, <vscale x 8 x i64> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 16 x i64> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_nxv16i64'
@@ -403,7 +403,7 @@ define <8 x half> @vzip_concat_v8f16(<4 x half> %a, <4 x half> %b) {
define <vscale x 8 x half> @vzip_intrinsic_nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_nxv8f16'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = call <vscale x 8 x half> @llvm.vector.interleave2.nxv8f16(<vscale x 4 x half> %a, <vscale x 4 x half> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x half> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8f16'
@@ -431,7 +431,7 @@ define <8 x float> @vzip_concat_v8f32(<4 x float> %a, <4 x float> %b) {
;
; ZVE32-LABEL: 'vzip_concat_v8f32'
; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x float> %concat, <8 x float> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x float> %res
;
%concat = shufflevector <4 x float> %a, <4 x float> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
@@ -441,7 +441,7 @@ define <8 x float> @vzip_concat_v8f32(<4 x float> %a, <4 x float> %b) {
define <vscale x 8 x float> @vzip_intrinsic_nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_nxv8f32'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_nxv8f32'
@@ -449,7 +449,7 @@ define <vscale x 8 x float> @vzip_intrinsic_nxv8f32(<vscale x 4 x float> %a, <vs
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
;
; ZVE32-LABEL: 'vzip_intrinsic_nxv8f32'
-; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 8 x float> %res
;
%res = call <vscale x 8 x float> @llvm.vector.interleave2.nxv8f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b)
@@ -459,7 +459,7 @@ define <vscale x 8 x float> @vzip_intrinsic_nxv8f32(<vscale x 4 x float> %a, <vs
define <8 x double> @vzip_concat_v8f64(<4 x double> %a, <4 x double> %b) {
; ZVZIP-LABEL: 'vzip_concat_v8f64'
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x double> %a, <4 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x double> %concat, <8 x double> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x double> %res
;
; NOZVZIP-LABEL: 'vzip_concat_v8f64'
@@ -479,7 +479,7 @@ define <8 x double> @vzip_concat_v8f64(<4 x double> %a, <4 x double> %b) {
define <vscale x 4 x double> @vzip_intrinsic_nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
; ZVZIP-LABEL: 'vzip_intrinsic_nxv4f64'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call <vscale x 4 x double> @llvm.vector.interleave2.nxv4f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <vscale x 4 x double> %res
;
; NOZVZIP-LABEL: 'vzip_intrinsic_nxv4f64'
@@ -504,7 +504,7 @@ define <2 x i32> @deinterleave_v2i32(<4 x i32> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
;
; ZVE32-LABEL: 'deinterleave_v2i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %res
;
%res = shufflevector <4 x i32> %v, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
@@ -513,7 +513,7 @@ define <2 x i32> @deinterleave_v2i32(<4 x i32> %v) {
define <4 x i32> @deinterleave_even_v4i32(<8 x i32> %v) {
; ZVZIP-LABEL: 'deinterleave_even_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'deinterleave_even_v4i32'
@@ -521,7 +521,7 @@ define <4 x i32> @deinterleave_even_v4i32(<8 x i32> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'deinterleave_even_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
@@ -530,7 +530,7 @@ define <4 x i32> @deinterleave_even_v4i32(<8 x i32> %v) {
define <4 x i32> @deinterleave_odd_v4i32(<8 x i32> %v) {
; ZVZIP-LABEL: 'deinterleave_odd_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'deinterleave_odd_v4i32'
@@ -538,7 +538,7 @@ define <4 x i32> @deinterleave_odd_v4i32(<8 x i32> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'deinterleave_odd_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
@@ -547,7 +547,7 @@ define <4 x i32> @deinterleave_odd_v4i32(<8 x i32> %v) {
define { <vscale x 4 x i32>, <vscale x 4 x i32> } @vunzip_intrinsic_nxv8i32(<vscale x 8 x i32> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8i32'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8i32'
@@ -555,7 +555,7 @@ define { <vscale x 4 x i32>, <vscale x 4 x i32> } @vunzip_intrinsic_nxv8i32(<vsc
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
;
; ZVE32-LABEL: 'vunzip_intrinsic_nxv8i32'
-; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } %res
;
%res = call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.vector.deinterleave2.nxv8i32(<vscale x 8 x i32> %v)
@@ -564,7 +564,7 @@ define { <vscale x 4 x i32>, <vscale x 4 x i32> } @vunzip_intrinsic_nxv8i32(<vsc
define { <4 x i32>, <4 x i32> } @vunzip_intrinsic_v8i32(<8 x i32> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_v8i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 39 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_v8i32'
@@ -572,7 +572,7 @@ define { <4 x i32>, <4 x i32> } @vunzip_intrinsic_v8i32(<8 x i32> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
;
; ZVE32-LABEL: 'vunzip_intrinsic_v8i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 39 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res
;
%res = call { <4 x i32>, <4 x i32> } @llvm.vector.deinterleave2.v8i32(<8 x i32> %v)
@@ -598,7 +598,7 @@ define <1 x i64> @deinterleave_v1i64(<2 x i64> %v) {
define <4 x i64> @vunzipe_v4i64(<8 x i64> %v) {
; ZVZIP-LABEL: 'vunzipe_v4i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
;
; NOZVZIP-LABEL: 'vunzipe_v4i64'
@@ -615,7 +615,7 @@ define <4 x i64> @vunzipe_v4i64(<8 x i64> %v) {
define <4 x i64> @vunzipo_v4i64(<8 x i64> %v) {
; ZVZIP-LABEL: 'vunzipo_v4i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
;
; NOZVZIP-LABEL: 'vunzipo_v4i64'
@@ -632,7 +632,7 @@ define <4 x i64> @vunzipo_v4i64(<8 x i64> %v) {
define <4 x i64> @vunzipe_poison_mask_v4i64(<8 x i64> %v) {
; ZVZIP-LABEL: 'vunzipe_poison_mask_v4i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i64> %v, <8 x i64> poison, <4 x i32> <i32 0, i32 poison, i32 4, i32 poison>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
;
; NOZVZIP-LABEL: 'vunzipe_poison_mask_v4i64'
@@ -666,7 +666,7 @@ define <4 x i64> @non_vunzip_single_defined_v4i64(<8 x i64> %v) {
define { <4 x i64>, <4 x i64> } @vunzip_intrinsic_v8i64(<8 x i64> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_v8i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 45 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_v8i64'
@@ -674,7 +674,7 @@ define { <4 x i64>, <4 x i64> } @vunzip_intrinsic_v8i64(<8 x i64> %v) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
;
; ZVE32-LABEL: 'vunzip_intrinsic_v8i64'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i64>, <4 x i64> } %res
;
%res = call { <4 x i64>, <4 x i64> } @llvm.vector.deinterleave2.v8i64(<8 x i64> %v)
@@ -683,7 +683,7 @@ define { <4 x i64>, <4 x i64> } @vunzip_intrinsic_v8i64(<8 x i64> %v) {
define <8 x i64> @vunzipe_v8i64(<16 x i64> %v) {
; ZVZIP-LABEL: 'vunzipe_v8i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = shufflevector <16 x i64> %v, <16 x i64> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res
;
; NOZVZIP-LABEL: 'vunzipe_v8i64'
@@ -700,7 +700,7 @@ define <8 x i64> @vunzipe_v8i64(<16 x i64> %v) {
define { <vscale x 8 x i64>, <vscale x 8 x i64> } @vunzip_intrinsic_nxv16i64(<vscale x 16 x i64> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_nxv16i64'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %res = call { <vscale x 8 x i64>, <vscale x 8 x i64> } @llvm.vector.deinterleave2.nxv16i64(<vscale x 16 x i64> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 8 x i64>, <vscale x 8 x i64> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv16i64'
@@ -717,7 +717,7 @@ define { <vscale x 8 x i64>, <vscale x 8 x i64> } @vunzip_intrinsic_nxv16i64(<vs
define { <vscale x 4 x half>, <vscale x 4 x half> } @vunzip_intrinsic_nxv8f16(<vscale x 8 x half> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8f16'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = call { <vscale x 4 x half>, <vscale x 4 x half> } @llvm.vector.deinterleave2.nxv8f16(<vscale x 8 x half> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x half>, <vscale x 4 x half> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8f16'
@@ -734,7 +734,7 @@ define { <vscale x 4 x half>, <vscale x 4 x half> } @vunzip_intrinsic_nxv8f16(<v
define { <vscale x 4 x float>, <vscale x 4 x float> } @vunzip_intrinsic_nxv8f32(<vscale x 8 x float> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_nxv8f32'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv8f32'
@@ -742,7 +742,7 @@ define { <vscale x 4 x float>, <vscale x 4 x float> } @vunzip_intrinsic_nxv8f32(
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
;
; ZVE32-LABEL: 'vunzip_intrinsic_nxv8f32'
-; ZVE32-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 4 x float>, <vscale x 4 x float> } %res
;
%res = call { <vscale x 4 x float>, <vscale x 4 x float> } @llvm.vector.deinterleave2.nxv8f32(<vscale x 8 x float> %v)
@@ -751,7 +751,7 @@ define { <vscale x 4 x float>, <vscale x 4 x float> } @vunzip_intrinsic_nxv8f32(
define { <vscale x 2 x double>, <vscale x 2 x double> } @vunzip_intrinsic_nxv4f64(<vscale x 4 x double> %v) {
; ZVZIP-LABEL: 'vunzip_intrinsic_nxv4f64'
-; ZVZIP-NEXT: Cost Model: Invalid cost for instruction: %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %res = call { <vscale x 2 x double>, <vscale x 2 x double> } @llvm.vector.deinterleave2.nxv4f64(<vscale x 4 x double> %v)
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <vscale x 2 x double>, <vscale x 2 x double> } %res
;
; NOZVZIP-LABEL: 'vunzip_intrinsic_nxv4f64'
@@ -768,7 +768,7 @@ define { <vscale x 2 x double>, <vscale x 2 x double> } @vunzip_intrinsic_nxv4f6
define <4 x i32> @vpaire_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vpaire_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vpaire_v4i32'
@@ -776,7 +776,7 @@ define <4 x i32> @vpaire_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vpaire_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
@@ -785,7 +785,7 @@ define <4 x i32> @vpaire_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @vpairo_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vpairo_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vpairo_v4i32'
@@ -793,7 +793,7 @@ define <4 x i32> @vpairo_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vpairo_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
@@ -802,7 +802,7 @@ define <4 x i32> @vpairo_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i64> @vpaire_v4i64(<4 x i64> %a, <4 x i64> %b) {
; ZVZIP-LABEL: 'vpaire_v4i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
;
; NOZVZIP-LABEL: 'vpaire_v4i64'
@@ -819,7 +819,7 @@ define <4 x i64> @vpaire_v4i64(<4 x i64> %a, <4 x i64> %b) {
define <4 x i64> @vpairo_v4i64(<4 x i64> %a, <4 x i64> %b) {
; ZVZIP-LABEL: 'vpairo_v4i64'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %res
;
; NOZVZIP-LABEL: 'vpairo_v4i64'
@@ -853,7 +853,7 @@ define <8 x i1> @vpaire_v8i1(<8 x i1> %a, <8 x i1> %b) {
define <4 x i32> @vpaire_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vpaire_swapped_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vpaire_swapped_v4i32'
@@ -861,7 +861,7 @@ define <4 x i32> @vpaire_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vpaire_swapped_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
@@ -870,7 +870,7 @@ define <4 x i32> @vpaire_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
define <4 x i32> @vpairo_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
; ZVZIP-LABEL: 'vpairo_swapped_v4i32'
-; ZVZIP-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+; ZVZIP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
; ZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; NOZVZIP-LABEL: 'vpairo_swapped_v4i32'
@@ -878,7 +878,7 @@ define <4 x i32> @vpairo_swapped_v4i32(<4 x i32> %a, <4 x i32> %b) {
; NOZVZIP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
; ZVE32-LABEL: 'vpairo_swapped_v4i32'
-; ZVE32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
+; ZVE32-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
; ZVE32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %res
;
%res = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
>From c205ed43230915eaf3877a4634df6f7b5ab19cfe Mon Sep 17 00:00:00 2001
From: Mingliang Liu <liumingliang.dev at bytedance.com>
Date: Mon, 21 Sep 2026 17:48:29 +0800
Subject: [PATCH 3/3] [RISCV] Move pair shuffle helpers to
RISCVPerfectShuffle.h
---
llvm/include/llvm/Analysis/VectorUtils.h | 20 ------
llvm/lib/Analysis/VectorUtils.cpp | 41 -----------
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 5 +-
llvm/lib/Target/RISCV/RISCVPerfectShuffle.h | 71 +++++++++++++++++++
.../Target/RISCV/RISCVTargetTransformInfo.cpp | 5 +-
5 files changed, 77 insertions(+), 65 deletions(-)
create mode 100644 llvm/lib/Target/RISCV/RISCVPerfectShuffle.h
diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h
index edd15000def14..b177d9eec2189 100644
--- a/llvm/include/llvm/Analysis/VectorUtils.h
+++ b/llvm/include/llvm/Analysis/VectorUtils.h
@@ -229,26 +229,6 @@ LLVM_ABI bool getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
LLVM_ABI bool isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
std::array<std::pair<int, int>, 2> &SrcInfo);
-/// Given a shuffle which can be represented as a pair of two slides, return
-/// true if it is a pair-even idiom and set \p Factor to its pairing factor.
-/// The mappings in \p SrcInfo may be in either order.
-/// Pair-even is:
-/// Input 0: a0 a1 a2 a3
-/// Input 1: b0 b1 b2 b3
-/// Result: a0 b0 a2 b2
-LLVM_ABI bool isPairEvenShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor);
-
-/// Given a shuffle which can be represented as a pair of two slides, return
-/// true if it is a pair-odd idiom and set \p Factor to its pairing factor.
-/// The mappings in \p SrcInfo may be in either order.
-/// Pair-odd is:
-/// Input 0: a0 a1 a2 a3
-/// Input 1: b0 b1 b2 b3
-/// Result: a1 b1 a3 b3
-LLVM_ABI bool isPairOddShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor);
-
/// Replace each shuffle mask index with the scaled sequential indices for an
/// equivalent mask of narrowed elements. Mask elements that are less than 0
/// (sentinel values) are repeated in the output mask.
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp
index f5a2f1ae6fe1c..1c105ebb772b3 100644
--- a/llvm/lib/Analysis/VectorUtils.cpp
+++ b/llvm/lib/Analysis/VectorUtils.cpp
@@ -513,47 +513,6 @@ bool llvm::isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
return SrcInfo[0].first != -1;
}
-static bool
-isAlternatingShuffleMask(const std::array<std::pair<int, int>, 2> &SrcInfo,
- ArrayRef<int> Mask, unsigned Factor,
- bool RequiredPolarity) {
- int NumElts = Mask.size();
- for (const auto &[Idx, M] : enumerate(Mask)) {
- if (M < 0)
- continue;
- int Src = M >= NumElts;
- int Diff = static_cast<int>(Idx) - (M % NumElts);
- bool C = Src == SrcInfo[1].first && Diff == SrcInfo[1].second;
- assert(C != (Src == SrcInfo[0].first && Diff == SrcInfo[0].second) &&
- "Must match exactly one of the two slides");
- if (RequiredPolarity != (C == (Idx / Factor) % 2))
- return false;
- }
- return true;
-}
-
-bool llvm::isPairEvenShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor) {
- if (SrcInfo[1].second == 0)
- std::swap(SrcInfo[0], SrcInfo[1]);
-
- Factor = SrcInfo[1].second;
- return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
- Mask.size() % Factor == 0 &&
- isAlternatingShuffleMask(SrcInfo, Mask, Factor, true);
-}
-
-bool llvm::isPairOddShuffleMask(std::array<std::pair<int, int>, 2> SrcInfo,
- ArrayRef<int> Mask, unsigned &Factor) {
- if (SrcInfo[1].second == 0)
- std::swap(SrcInfo[0], SrcInfo[1]);
-
- Factor = -SrcInfo[1].second;
- return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
- Mask.size() % Factor == 0 &&
- isAlternatingShuffleMask(SrcInfo, Mask, Factor, false);
-}
-
void llvm::narrowShuffleMaskElts(int Scale, ArrayRef<int> Mask,
SmallVectorImpl<int> &ScaledMask) {
assert(Scale > 0 && "Unexpected scaling factor");
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 5b7a93052d65c..d0693b858307a 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -16,6 +16,7 @@
#include "RISCV.h"
#include "RISCVConstantPoolValue.h"
#include "RISCVMachineFunctionInfo.h"
+#include "RISCVPerfectShuffle.h"
#include "RISCVRegisterInfo.h"
#include "RISCVSelectionDAGInfo.h"
#include "RISCVSubtarget.h"
@@ -6991,7 +6992,7 @@ SDValue RISCVTargetLowering::lowerVECTOR_SHUFFLE(SDValue Op,
if (Subtarget.hasStdExtZvzip()) {
bool TryWiden = false;
unsigned Factor;
- if (isPairEvenShuffleMask(SrcInfo, Mask, Factor)) {
+ if (isPairEven(SrcInfo, Mask, Factor)) {
if (Factor == 1) {
SDValue Src1 = SrcInfo[0].first == 0 ? V1 : V2;
SDValue Src2 = SrcInfo[1].first == 0 ? V1 : V2;
@@ -7000,7 +7001,7 @@ SDValue RISCVTargetLowering::lowerVECTOR_SHUFFLE(SDValue Op,
}
TryWiden = true;
}
- if (isPairOddShuffleMask(SrcInfo, Mask, Factor)) {
+ if (isPairOdd(SrcInfo, Mask, Factor)) {
if (Factor == 1) {
SDValue Src1 = SrcInfo[1].first == 0 ? V1 : V2;
SDValue Src2 = SrcInfo[0].first == 0 ? V1 : V2;
diff --git a/llvm/lib/Target/RISCV/RISCVPerfectShuffle.h b/llvm/lib/Target/RISCV/RISCVPerfectShuffle.h
new file mode 100644
index 0000000000000..a53f93f63f3ae
--- /dev/null
+++ b/llvm/lib/Target/RISCV/RISCVPerfectShuffle.h
@@ -0,0 +1,71 @@
+//===-- RISCVPerfectShuffle.h - RISC-V shuffle helpers ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines helpers for recognizing vector shuffle masks that can be
+// lowered with RISC-V vector permutation instructions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_RISCV_RISCVPERFECTSHUFFLE_H
+#define LLVM_LIB_TARGET_RISCV_RISCVPERFECTSHUFFLE_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/MathExtras.h"
+
+namespace llvm {
+
+inline bool isAlternating(const std::array<std::pair<int, int>, 2> &SrcInfo,
+ ArrayRef<int> Mask, unsigned Factor,
+ bool RequiredPolarity) {
+ int NumElts = Mask.size();
+ for (const auto &[Idx, M] : enumerate(Mask)) {
+ if (M < 0)
+ continue;
+ int Src = M >= NumElts;
+ int Diff = (int)Idx - (M % NumElts);
+ bool C = Src == SrcInfo[1].first && Diff == SrcInfo[1].second;
+ assert(C != (Src == SrcInfo[0].first && Diff == SrcInfo[0].second) &&
+ "Must match exactly one of the two slides");
+ if (RequiredPolarity != (C == (Idx / Factor) % 2))
+ return false;
+ }
+ return true;
+}
+
+/// Given a shuffle which can be represented as a pair of two slides,
+/// see if it is a pair-even idiom.
+/// Pair-even is:
+/// vs2: a0 a1 a2 a3
+/// vs1: b0 b1 b2 b3
+/// vd: a0 b0 a2 b2
+inline bool isPairEven(const std::array<std::pair<int, int>, 2> &SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor) {
+ Factor = SrcInfo[1].second;
+ return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
+ Mask.size() % Factor == 0 &&
+ isAlternating(SrcInfo, Mask, Factor, true);
+}
+
+/// Given a shuffle which can be represented as a pair of two slides,
+/// see if it is a pair-odd idiom.
+/// Pair-odd is:
+/// vs2: a0 a1 a2 a3
+/// vs1: b0 b1 b2 b3
+/// vd: a1 b1 a3 b3
+/// Note that the operand order is swapped due to the way we canonicalize
+/// the slides, so SrCInfo[0] is vs1, and SrcInfo[1] is vs2.
+inline bool isPairOdd(const std::array<std::pair<int, int>, 2> &SrcInfo,
+ ArrayRef<int> Mask, unsigned &Factor) {
+ Factor = -SrcInfo[1].second;
+ return SrcInfo[0].second == 0 && isPowerOf2_32(Factor) &&
+ Mask.size() % Factor == 0 &&
+ isAlternating(SrcInfo, Mask, Factor, false);
+}
+} // end namespace llvm
+
+#endif // LLVM_LIB_TARGET_RISCV_RISCVPERFECTSHUFFLE_H
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 0bcff20e4f84b..0f8fad968fea7 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -8,6 +8,7 @@
#include "RISCVTargetTransformInfo.h"
#include "MCTargetDesc/RISCVMatInt.h"
+#include "RISCVPerfectShuffle.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/BasicTTIImpl.h"
@@ -710,9 +711,9 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
if (ST->hasStdExtZvzip() && LT.second.getScalarSizeInBits() != 1) {
unsigned Factor;
- if (isPairEvenShuffleMask(SrcInfo, Mask, Factor) && Factor == 1)
+ if (isPairEven(SrcInfo, Mask, Factor) && Factor == 1)
return getRISCVInstructionCost(RISCV::VPAIRE_VV, LT.second, CostKind);
- if (isPairOddShuffleMask(SrcInfo, Mask, Factor) && Factor == 1)
+ if (isPairOdd(SrcInfo, Mask, Factor) && Factor == 1)
return getRISCVInstructionCost(RISCV::VPAIRO_VV, LT.second, CostKind);
}
More information about the llvm-commits
mailing list