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_load_v16i1_v32i1(ptr %p) {
8 ; CHECK-LABEL: vector_deinterleave_load_v16i1_v32i1:
10 ; CHECK-NEXT: li a1, 32
11 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
12 ; CHECK-NEXT: vlm.v v0, (a0)
13 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
14 ; CHECK-NEXT: vmv.v.i v8, 0
15 ; CHECK-NEXT: vmerge.vim v10, v8, 1, v0
16 ; CHECK-NEXT: vid.v v9
17 ; CHECK-NEXT: vadd.vv v11, v9, v9
18 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
19 ; CHECK-NEXT: vslidedown.vi v0, v0, 2
20 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
21 ; CHECK-NEXT: vrgather.vv v9, v10, v11
22 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
23 ; CHECK-NEXT: li a0, -256
24 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
25 ; CHECK-NEXT: vmv.s.x v0, a0
26 ; CHECK-NEXT: vsetvli zero, zero, e8, m1, ta, mu
27 ; CHECK-NEXT: vadd.vi v12, v11, -16
28 ; CHECK-NEXT: vrgather.vv v9, v8, v12, v0.t
29 ; CHECK-NEXT: vmsne.vi v9, v9, 0
30 ; CHECK-NEXT: vadd.vi v12, v11, 1
31 ; CHECK-NEXT: vrgather.vv v13, v10, v12
32 ; CHECK-NEXT: vadd.vi v10, v11, -15
33 ; CHECK-NEXT: vrgather.vv v13, v8, v10, v0.t
34 ; CHECK-NEXT: vmsne.vi v8, v13, 0
35 ; CHECK-NEXT: vmv.v.v v0, v9
37 %vec = load <32 x i1>, ptr %p
38 %retval = call {<16 x i1>, <16 x i1>} @llvm.vector.deinterleave2.v32i1(<32 x i1> %vec)
39 ret {<16 x i1>, <16 x i1>} %retval
42 define {<16 x i8>, <16 x i8>} @vector_deinterleave_load_v16i8_v32i8(ptr %p) {
43 ; CHECK-LABEL: vector_deinterleave_load_v16i8_v32i8:
45 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
46 ; CHECK-NEXT: vlseg2e8.v v8, (a0)
48 %vec = load <32 x i8>, ptr %p
49 %retval = call {<16 x i8>, <16 x i8>} @llvm.vector.deinterleave2.v32i8(<32 x i8> %vec)
50 ret {<16 x i8>, <16 x i8>} %retval
53 ; Shouldn't be lowered to vlseg because it's unaligned
54 define {<8 x i16>, <8 x i16>} @vector_deinterleave_load_v8i16_v16i16_align1(ptr %p) {
55 ; CHECK-LABEL: vector_deinterleave_load_v8i16_v16i16_align1:
57 ; CHECK-NEXT: li a1, 32
58 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
59 ; CHECK-NEXT: vle8.v v10, (a0)
60 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
61 ; CHECK-NEXT: vnsrl.wi v8, v10, 0
62 ; CHECK-NEXT: vnsrl.wi v9, v10, 16
64 %vec = load <16 x i16>, ptr %p, align 1
65 %retval = call {<8 x i16>, <8 x i16>} @llvm.vector.deinterleave2.v16i16(<16 x i16> %vec)
66 ret {<8 x i16>, <8 x i16>} %retval
69 define {<8 x i16>, <8 x i16>} @vector_deinterleave_load_v8i16_v16i16(ptr %p) {
70 ; CHECK-LABEL: vector_deinterleave_load_v8i16_v16i16:
72 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
73 ; CHECK-NEXT: vlseg2e16.v v8, (a0)
75 %vec = load <16 x i16>, ptr %p
76 %retval = call {<8 x i16>, <8 x i16>} @llvm.vector.deinterleave2.v16i16(<16 x i16> %vec)
77 ret {<8 x i16>, <8 x i16>} %retval
80 define {<4 x i32>, <4 x i32>} @vector_deinterleave_load_v4i32_vv8i32(ptr %p) {
81 ; CHECK-LABEL: vector_deinterleave_load_v4i32_vv8i32:
83 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
84 ; CHECK-NEXT: vlseg2e32.v v8, (a0)
86 %vec = load <8 x i32>, ptr %p
87 %retval = call {<4 x i32>, <4 x i32>} @llvm.vector.deinterleave2.v8i32(<8 x i32> %vec)
88 ret {<4 x i32>, <4 x i32>} %retval
91 define {<2 x i64>, <2 x i64>} @vector_deinterleave_load_v2i64_v4i64(ptr %p) {
92 ; CHECK-LABEL: vector_deinterleave_load_v2i64_v4i64:
94 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
95 ; CHECK-NEXT: vlseg2e64.v v8, (a0)
97 %vec = load <4 x i64>, ptr %p
98 %retval = call {<2 x i64>, <2 x i64>} @llvm.vector.deinterleave2.v4i64(<4 x i64> %vec)
99 ret {<2 x i64>, <2 x i64>} %retval
102 declare {<16 x i1>, <16 x i1>} @llvm.vector.deinterleave2.v32i1(<32 x i1>)
103 declare {<16 x i8>, <16 x i8>} @llvm.vector.deinterleave2.v32i8(<32 x i8>)
104 declare {<8 x i16>, <8 x i16>} @llvm.vector.deinterleave2.v16i16(<16 x i16>)
105 declare {<4 x i32>, <4 x i32>} @llvm.vector.deinterleave2.v8i32(<8 x i32>)
106 declare {<2 x i64>, <2 x i64>} @llvm.vector.deinterleave2.v4i64(<4 x i64>)
110 define {<2 x half>, <2 x half>} @vector_deinterleave_load_v2f16_v4f16(ptr %p) {
111 ; CHECK-LABEL: vector_deinterleave_load_v2f16_v4f16:
113 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
114 ; CHECK-NEXT: vlseg2e16.v v8, (a0)
116 %vec = load <4 x half>, ptr %p
117 %retval = call {<2 x half>, <2 x half>} @llvm.vector.deinterleave2.v4f16(<4 x half> %vec)
118 ret {<2 x half>, <2 x half>} %retval
121 define {<4 x half>, <4 x half>} @vector_deinterleave_load_v4f16_v8f16(ptr %p) {
122 ; CHECK-LABEL: vector_deinterleave_load_v4f16_v8f16:
124 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
125 ; CHECK-NEXT: vlseg2e16.v v8, (a0)
127 %vec = load <8 x half>, ptr %p
128 %retval = call {<4 x half>, <4 x half>} @llvm.vector.deinterleave2.v8f16(<8 x half> %vec)
129 ret {<4 x half>, <4 x half>} %retval
132 define {<2 x float>, <2 x float>} @vector_deinterleave_load_v2f32_v4f32(ptr %p) {
133 ; CHECK-LABEL: vector_deinterleave_load_v2f32_v4f32:
135 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
136 ; CHECK-NEXT: vlseg2e32.v v8, (a0)
138 %vec = load <4 x float>, ptr %p
139 %retval = call {<2 x float>, <2 x float>} @llvm.vector.deinterleave2.v4f32(<4 x float> %vec)
140 ret {<2 x float>, <2 x float>} %retval
143 define {<8 x half>, <8 x half>} @vector_deinterleave_load_v8f16_v16f16(ptr %p) {
144 ; CHECK-LABEL: vector_deinterleave_load_v8f16_v16f16:
146 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
147 ; CHECK-NEXT: vlseg2e16.v v8, (a0)
149 %vec = load <16 x half>, ptr %p
150 %retval = call {<8 x half>, <8 x half>} @llvm.vector.deinterleave2.v16f16(<16 x half> %vec)
151 ret {<8 x half>, <8 x half>} %retval
154 define {<4 x float>, <4 x float>} @vector_deinterleave_load_v4f32_v8f32(ptr %p) {
155 ; CHECK-LABEL: vector_deinterleave_load_v4f32_v8f32:
157 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
158 ; CHECK-NEXT: vlseg2e32.v v8, (a0)
160 %vec = load <8 x float>, ptr %p
161 %retval = call {<4 x float>, <4 x float>} @llvm.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_load_v2f64_v4f64(ptr %p) {
166 ; CHECK-LABEL: vector_deinterleave_load_v2f64_v4f64:
168 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
169 ; CHECK-NEXT: vlseg2e64.v v8, (a0)
171 %vec = load <4 x double>, ptr %p
172 %retval = call {<2 x double>, <2 x double>} @llvm.vector.deinterleave2.v4f64(<4 x double> %vec)
173 ret {<2 x double>, <2 x double>} %retval
176 declare {<2 x half>,<2 x half>} @llvm.vector.deinterleave2.v4f16(<4 x half>)
177 declare {<4 x half>, <4 x half>} @llvm.vector.deinterleave2.v8f16(<8 x half>)
178 declare {<2 x float>, <2 x float>} @llvm.vector.deinterleave2.v4f32(<4 x float>)
179 declare {<8 x half>, <8 x half>} @llvm.vector.deinterleave2.v16f16(<16 x half>)
180 declare {<4 x float>, <4 x float>} @llvm.vector.deinterleave2.v8f32(<8 x float>)
181 declare {<2 x double>, <2 x double>} @llvm.vector.deinterleave2.v4f64(<4 x double>)