1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv32 -mattr=+v,+zfh,+zvfh | FileCheck %s
3 ; RUN: llc < %s -mtriple=riscv64 -mattr=+v,+zfh,+zvfh | FileCheck %s
7 define {<16 x i1>, <16 x i1>} @vector_deinterleave_v16i1_v32i1(<32 x i1> %vec) {
8 ; CHECK-LABEL: vector_deinterleave_v16i1_v32i1:
10 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
11 ; CHECK-NEXT: vmv.v.i v8, 0
12 ; CHECK-NEXT: vmerge.vim v10, v8, 1, v0
13 ; CHECK-NEXT: vid.v v9
14 ; CHECK-NEXT: vadd.vv v11, v9, v9
15 ; CHECK-NEXT: vrgather.vv v9, v10, v11
16 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
17 ; CHECK-NEXT: vslidedown.vi v0, v0, 2
18 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
19 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
20 ; CHECK-NEXT: vadd.vi v12, v11, -16
21 ; CHECK-NEXT: li a0, -256
22 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
23 ; CHECK-NEXT: vmv.s.x v0, a0
24 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, mu
25 ; CHECK-NEXT: vrgather.vv v9, v8, v12, v0.t
26 ; CHECK-NEXT: vmsne.vi v9, v9, 0
27 ; CHECK-NEXT: vadd.vi v12, v11, 1
28 ; CHECK-NEXT: vrgather.vv v13, v10, v12
29 ; CHECK-NEXT: vadd.vi v10, v11, -15
30 ; CHECK-NEXT: vrgather.vv v13, v8, v10, v0.t
31 ; CHECK-NEXT: vmsne.vi v8, v13, 0
32 ; CHECK-NEXT: vmv.v.v v0, v9
34 %retval = call {<16 x i1>, <16 x i1>} @llvm.experimental.vector.deinterleave2.v32i1(<32 x i1> %vec)
35 ret {<16 x i1>, <16 x i1>} %retval
38 define {<16 x i8>, <16 x i8>} @vector_deinterleave_v16i8_v32i8(<32 x i8> %vec) {
39 ; CHECK-LABEL: vector_deinterleave_v16i8_v32i8:
41 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
42 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
43 ; CHECK-NEXT: vnsrl.wi v11, v8, 8
44 ; CHECK-NEXT: vmv.v.v v8, v10
45 ; CHECK-NEXT: vmv.v.v v9, v11
47 %retval = call {<16 x i8>, <16 x i8>} @llvm.experimental.vector.deinterleave2.v32i8(<32 x i8> %vec)
48 ret {<16 x i8>, <16 x i8>} %retval
51 define {<8 x i16>, <8 x i16>} @vector_deinterleave_v8i16_v16i16(<16 x i16> %vec) {
52 ; CHECK-LABEL: vector_deinterleave_v8i16_v16i16:
54 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
55 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
56 ; CHECK-NEXT: vnsrl.wi v11, v8, 16
57 ; CHECK-NEXT: vmv.v.v v8, v10
58 ; CHECK-NEXT: vmv.v.v v9, v11
60 %retval = call {<8 x i16>, <8 x i16>} @llvm.experimental.vector.deinterleave2.v16i16(<16 x i16> %vec)
61 ret {<8 x i16>, <8 x i16>} %retval
64 define {<4 x i32>, <4 x i32>} @vector_deinterleave_v4i32_vv8i32(<8 x i32> %vec) {
65 ; CHECK-LABEL: vector_deinterleave_v4i32_vv8i32:
67 ; CHECK-NEXT: li a0, 32
68 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
69 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
70 ; CHECK-NEXT: vnsrl.wi v11, v8, 0
71 ; CHECK-NEXT: vmv.v.v v8, v11
72 ; CHECK-NEXT: vmv.v.v v9, v10
74 %retval = call {<4 x i32>, <4 x i32>} @llvm.experimental.vector.deinterleave2.v8i32(<8 x i32> %vec)
75 ret {<4 x i32>, <4 x i32>} %retval
78 define {<2 x i64>, <2 x i64>} @vector_deinterleave_v2i64_v4i64(<4 x i64> %vec) {
79 ; CHECK-LABEL: vector_deinterleave_v2i64_v4i64:
81 ; CHECK-NEXT: vsetivli zero, 2, e64, m2, ta, ma
82 ; CHECK-NEXT: vslidedown.vi v10, v8, 2
83 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
84 ; CHECK-NEXT: vmv.v.i v0, 2
85 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, mu
86 ; CHECK-NEXT: vrgather.vi v9, v8, 1
87 ; CHECK-NEXT: vrgather.vi v9, v10, 1, v0.t
88 ; CHECK-NEXT: vslideup.vi v8, v10, 1
90 %retval = call {<2 x i64>, <2 x i64>} @llvm.experimental.vector.deinterleave2.v4i64(<4 x i64> %vec)
91 ret {<2 x i64>, <2 x i64>} %retval
94 declare {<16 x i1>, <16 x i1>} @llvm.experimental.vector.deinterleave2.v32i1(<32 x i1>)
95 declare {<16 x i8>, <16 x i8>} @llvm.experimental.vector.deinterleave2.v32i8(<32 x i8>)
96 declare {<8 x i16>, <8 x i16>} @llvm.experimental.vector.deinterleave2.v16i16(<16 x i16>)
97 declare {<4 x i32>, <4 x i32>} @llvm.experimental.vector.deinterleave2.v8i32(<8 x i32>)
98 declare {<2 x i64>, <2 x i64>} @llvm.experimental.vector.deinterleave2.v4i64(<4 x i64>)
102 define {<2 x half>, <2 x half>} @vector_deinterleave_v2f16_v4f16(<4 x half> %vec) {
103 ; CHECK-LABEL: vector_deinterleave_v2f16_v4f16:
105 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
106 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
107 ; CHECK-NEXT: vnsrl.wi v9, v8, 16
108 ; CHECK-NEXT: vmv1r.v v8, v10
110 %retval = call {<2 x half>, <2 x half>} @llvm.experimental.vector.deinterleave2.v4f16(<4 x half> %vec)
111 ret {<2 x half>, <2 x half>} %retval
114 define {<4 x half>, <4 x half>} @vector_deinterleave_v4f16_v8f16(<8 x half> %vec) {
115 ; CHECK-LABEL: vector_deinterleave_v4f16_v8f16:
117 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
118 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
119 ; CHECK-NEXT: vnsrl.wi v9, v8, 16
120 ; CHECK-NEXT: vmv1r.v v8, v10
122 %retval = call {<4 x half>, <4 x half>} @llvm.experimental.vector.deinterleave2.v8f16(<8 x half> %vec)
123 ret {<4 x half>, <4 x half>} %retval
126 define {<2 x float>, <2 x float>} @vector_deinterleave_v2f32_v4f32(<4 x float> %vec) {
127 ; CHECK-LABEL: vector_deinterleave_v2f32_v4f32:
129 ; CHECK-NEXT: li a0, 32
130 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
131 ; CHECK-NEXT: vnsrl.wx v9, v8, a0
132 ; CHECK-NEXT: vnsrl.wi v8, v8, 0
134 %retval = call {<2 x float>, <2 x float>} @llvm.experimental.vector.deinterleave2.v4f32(<4 x float> %vec)
135 ret {<2 x float>, <2 x float>} %retval
138 define {<8 x half>, <8 x half>} @vector_deinterleave_v8f16_v16f16(<16 x half> %vec) {
139 ; CHECK-LABEL: vector_deinterleave_v8f16_v16f16:
141 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
142 ; CHECK-NEXT: vnsrl.wi v10, v8, 0
143 ; CHECK-NEXT: vnsrl.wi v11, v8, 16
144 ; CHECK-NEXT: vmv.v.v v8, v10
145 ; CHECK-NEXT: vmv.v.v v9, v11
147 %retval = call {<8 x half>, <8 x half>} @llvm.experimental.vector.deinterleave2.v16f16(<16 x half> %vec)
148 ret {<8 x half>, <8 x half>} %retval
151 define {<4 x float>, <4 x float>} @vector_deinterleave_v4f32_v8f32(<8 x float> %vec) {
152 ; CHECK-LABEL: vector_deinterleave_v4f32_v8f32:
154 ; CHECK-NEXT: li a0, 32
155 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
156 ; CHECK-NEXT: vnsrl.wx v10, v8, a0
157 ; CHECK-NEXT: vnsrl.wi v11, v8, 0
158 ; CHECK-NEXT: vmv.v.v v8, v11
159 ; CHECK-NEXT: vmv.v.v v9, v10
161 %retval = call {<4 x float>, <4 x float>} @llvm.experimental.vector.deinterleave2.v8f32(<8 x float> %vec)
162 ret {<4 x float>, <4 x float>} %retval
165 define {<2 x double>, <2 x double>} @vector_deinterleave_v2f64_v4f64(<4 x double> %vec) {
166 ; CHECK-LABEL: vector_deinterleave_v2f64_v4f64:
168 ; CHECK-NEXT: vsetivli zero, 2, e64, m2, ta, ma
169 ; CHECK-NEXT: vslidedown.vi v10, v8, 2
170 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
171 ; CHECK-NEXT: vmv.v.i v0, 2
172 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, mu
173 ; CHECK-NEXT: vrgather.vi v9, v8, 1
174 ; CHECK-NEXT: vrgather.vi v9, v10, 1, v0.t
175 ; CHECK-NEXT: vslideup.vi v8, v10, 1
177 %retval = call {<2 x double>, <2 x double>} @llvm.experimental.vector.deinterleave2.v4f64(<4 x double> %vec)
178 ret {<2 x double>, <2 x double>} %retval
181 declare {<2 x half>,<2 x half>} @llvm.experimental.vector.deinterleave2.v4f16(<4 x half>)
182 declare {<4 x half>, <4 x half>} @llvm.experimental.vector.deinterleave2.v8f16(<8 x half>)
183 declare {<2 x float>, <2 x float>} @llvm.experimental.vector.deinterleave2.v4f32(<4 x float>)
184 declare {<8 x half>, <8 x half>} @llvm.experimental.vector.deinterleave2.v16f16(<16 x half>)
185 declare {<4 x float>, <4 x float>} @llvm.experimental.vector.deinterleave2.v8f32(<8 x float>)
186 declare {<2 x double>, <2 x double>} @llvm.experimental.vector.deinterleave2.v4f64(<4 x double>)