1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v < %s | FileCheck %s
5 declare <4 x i16> @llvm.vp.zext.v4i16.v4i8(<4 x i8>, <4 x i1>, i32)
7 define <4 x i16> @vzext_v4i16_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
8 ; CHECK-LABEL: vzext_v4i16_v4i8:
10 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
11 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
12 ; CHECK-NEXT: vmv1r.v v8, v9
14 %v = call <4 x i16> @llvm.vp.zext.v4i16.v4i8(<4 x i8> %va, <4 x i1> %m, i32 %evl)
18 define <4 x i16> @vzext_v4i16_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
19 ; CHECK-LABEL: vzext_v4i16_v4i8_unmasked:
21 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
22 ; CHECK-NEXT: vzext.vf2 v9, v8
23 ; CHECK-NEXT: vmv1r.v v8, v9
25 %v = call <4 x i16> @llvm.vp.zext.v4i16.v4i8(<4 x i8> %va, <4 x i1> splat (i1 true), i32 %evl)
29 declare <4 x i32> @llvm.vp.zext.v4i32.v4i8(<4 x i8>, <4 x i1>, i32)
31 define <4 x i32> @vzext_v4i32_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
32 ; CHECK-LABEL: vzext_v4i32_v4i8:
34 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
35 ; CHECK-NEXT: vzext.vf4 v9, v8, v0.t
36 ; CHECK-NEXT: vmv.v.v v8, v9
38 %v = call <4 x i32> @llvm.vp.zext.v4i32.v4i8(<4 x i8> %va, <4 x i1> %m, i32 %evl)
42 define <4 x i32> @vzext_v4i32_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
43 ; CHECK-LABEL: vzext_v4i32_v4i8_unmasked:
45 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
46 ; CHECK-NEXT: vzext.vf4 v9, v8
47 ; CHECK-NEXT: vmv.v.v v8, v9
49 %v = call <4 x i32> @llvm.vp.zext.v4i32.v4i8(<4 x i8> %va, <4 x i1> splat (i1 true), i32 %evl)
53 declare <4 x i64> @llvm.vp.zext.v4i64.v4i8(<4 x i8>, <4 x i1>, i32)
55 define <4 x i64> @vzext_v4i64_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
56 ; CHECK-LABEL: vzext_v4i64_v4i8:
58 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
59 ; CHECK-NEXT: vzext.vf8 v10, v8, v0.t
60 ; CHECK-NEXT: vmv.v.v v8, v10
62 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i8(<4 x i8> %va, <4 x i1> %m, i32 %evl)
66 define <4 x i64> @vzext_v4i64_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
67 ; CHECK-LABEL: vzext_v4i64_v4i8_unmasked:
69 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
70 ; CHECK-NEXT: vzext.vf8 v10, v8
71 ; CHECK-NEXT: vmv.v.v v8, v10
73 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i8(<4 x i8> %va, <4 x i1> splat (i1 true), i32 %evl)
77 declare <4 x i32> @llvm.vp.zext.v4i32.v4i16(<4 x i16>, <4 x i1>, i32)
79 define <4 x i32> @vzext_v4i32_v4i16(<4 x i16> %va, <4 x i1> %m, i32 zeroext %evl) {
80 ; CHECK-LABEL: vzext_v4i32_v4i16:
82 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
83 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
84 ; CHECK-NEXT: vmv.v.v v8, v9
86 %v = call <4 x i32> @llvm.vp.zext.v4i32.v4i16(<4 x i16> %va, <4 x i1> %m, i32 %evl)
90 define <4 x i32> @vzext_v4i32_v4i16_unmasked(<4 x i16> %va, i32 zeroext %evl) {
91 ; CHECK-LABEL: vzext_v4i32_v4i16_unmasked:
93 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
94 ; CHECK-NEXT: vzext.vf2 v9, v8
95 ; CHECK-NEXT: vmv.v.v v8, v9
97 %v = call <4 x i32> @llvm.vp.zext.v4i32.v4i16(<4 x i16> %va, <4 x i1> splat (i1 true), i32 %evl)
101 declare <4 x i64> @llvm.vp.zext.v4i64.v4i16(<4 x i16>, <4 x i1>, i32)
103 define <4 x i64> @vzext_v4i64_v4i16(<4 x i16> %va, <4 x i1> %m, i32 zeroext %evl) {
104 ; CHECK-LABEL: vzext_v4i64_v4i16:
106 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
107 ; CHECK-NEXT: vzext.vf4 v10, v8, v0.t
108 ; CHECK-NEXT: vmv.v.v v8, v10
110 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i16(<4 x i16> %va, <4 x i1> %m, i32 %evl)
114 define <4 x i64> @vzext_v4i64_v4i16_unmasked(<4 x i16> %va, i32 zeroext %evl) {
115 ; CHECK-LABEL: vzext_v4i64_v4i16_unmasked:
117 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
118 ; CHECK-NEXT: vzext.vf4 v10, v8
119 ; CHECK-NEXT: vmv.v.v v8, v10
121 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i16(<4 x i16> %va, <4 x i1> splat (i1 true), i32 %evl)
125 declare <4 x i64> @llvm.vp.zext.v4i64.v4i32(<4 x i32>, <4 x i1>, i32)
127 define <4 x i64> @vzext_v4i64_v4i32(<4 x i32> %va, <4 x i1> %m, i32 zeroext %evl) {
128 ; CHECK-LABEL: vzext_v4i64_v4i32:
130 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
131 ; CHECK-NEXT: vzext.vf2 v10, v8, v0.t
132 ; CHECK-NEXT: vmv.v.v v8, v10
134 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i32(<4 x i32> %va, <4 x i1> %m, i32 %evl)
138 define <4 x i64> @vzext_v4i64_v4i32_unmasked(<4 x i32> %va, i32 zeroext %evl) {
139 ; CHECK-LABEL: vzext_v4i64_v4i32_unmasked:
141 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
142 ; CHECK-NEXT: vzext.vf2 v10, v8
143 ; CHECK-NEXT: vmv.v.v v8, v10
145 %v = call <4 x i64> @llvm.vp.zext.v4i64.v4i32(<4 x i32> %va, <4 x i1> splat (i1 true), i32 %evl)
149 declare <32 x i64> @llvm.vp.zext.v32i64.v32i32(<32 x i32>, <32 x i1>, i32)
151 define <32 x i64> @vzext_v32i64_v32i32(<32 x i32> %va, <32 x i1> %m, i32 zeroext %evl) {
152 ; CHECK-LABEL: vzext_v32i64_v32i32:
154 ; CHECK-NEXT: li a2, 16
155 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
156 ; CHECK-NEXT: vslidedown.vi v16, v0, 2
157 ; CHECK-NEXT: mv a1, a0
158 ; CHECK-NEXT: bltu a0, a2, .LBB12_2
159 ; CHECK-NEXT: # %bb.1:
160 ; CHECK-NEXT: li a1, 16
161 ; CHECK-NEXT: .LBB12_2:
162 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
163 ; CHECK-NEXT: vzext.vf2 v24, v8, v0.t
164 ; CHECK-NEXT: addi a1, a0, -16
165 ; CHECK-NEXT: sltu a0, a0, a1
166 ; CHECK-NEXT: addi a0, a0, -1
167 ; CHECK-NEXT: and a0, a0, a1
168 ; CHECK-NEXT: vsetivli zero, 16, e32, m8, ta, ma
169 ; CHECK-NEXT: vslidedown.vi v8, v8, 16
170 ; CHECK-NEXT: vmv1r.v v0, v16
171 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
172 ; CHECK-NEXT: vzext.vf2 v16, v8, v0.t
173 ; CHECK-NEXT: vmv8r.v v8, v24
175 %v = call <32 x i64> @llvm.vp.zext.v32i64.v32i32(<32 x i32> %va, <32 x i1> %m, i32 %evl)
179 define <32 x i64> @vzext_v32i64_v32i32_unmasked(<32 x i32> %va, i32 zeroext %evl) {
180 ; CHECK-LABEL: vzext_v32i64_v32i32_unmasked:
182 ; CHECK-NEXT: li a2, 16
183 ; CHECK-NEXT: mv a1, a0
184 ; CHECK-NEXT: bltu a0, a2, .LBB13_2
185 ; CHECK-NEXT: # %bb.1:
186 ; CHECK-NEXT: li a1, 16
187 ; CHECK-NEXT: .LBB13_2:
188 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
189 ; CHECK-NEXT: vzext.vf2 v24, v8
190 ; CHECK-NEXT: addi a1, a0, -16
191 ; CHECK-NEXT: sltu a0, a0, a1
192 ; CHECK-NEXT: addi a0, a0, -1
193 ; CHECK-NEXT: and a0, a0, a1
194 ; CHECK-NEXT: vsetivli zero, 16, e32, m8, ta, ma
195 ; CHECK-NEXT: vslidedown.vi v8, v8, 16
196 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
197 ; CHECK-NEXT: vzext.vf2 v16, v8
198 ; CHECK-NEXT: vmv8r.v v8, v24
200 %v = call <32 x i64> @llvm.vp.zext.v32i64.v32i32(<32 x i32> %va, <32 x i1> splat (i1 true), i32 %evl)
204 declare <4 x i16> @llvm.vp.zext.v4i16.v4i7(<4 x i7>, <4 x i1>, i32)
206 define <4 x i16> @vzext_v4i16_v4i7(<4 x i7> %va, <4 x i1> %m, i32 zeroext %evl) {
207 ; CHECK-LABEL: vzext_v4i16_v4i7:
209 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
210 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
211 ; CHECK-NEXT: li a0, 127
212 ; CHECK-NEXT: vand.vx v8, v9, a0, v0.t
214 %v = call <4 x i16> @llvm.vp.zext.v4i16.v4i7(<4 x i7> %va, <4 x i1> %m, i32 %evl)
218 declare <4 x i8> @llvm.vp.zext.v4i8.v4i7(<4 x i7>, <4 x i1>, i32)
220 define <4 x i8> @vzext_v4i8_v4i7(<4 x i7> %va, <4 x i1> %m, i32 zeroext %evl) {
221 ; CHECK-LABEL: vzext_v4i8_v4i7:
223 ; CHECK-NEXT: li a1, 127
224 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
225 ; CHECK-NEXT: vand.vx v8, v8, a1, v0.t
227 %v = call <4 x i8> @llvm.vp.zext.v4i8.v4i7(<4 x i7> %va, <4 x i1> %m, i32 %evl)
231 declare <4 x i15> @llvm.vp.zext.v4i15.v4i8(<4 x i8>, <4 x i1>, i32)
233 define <4 x i15> @vzext_v4i15_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
234 ; CHECK-LABEL: vzext_v4i15_v4i8:
236 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
237 ; CHECK-NEXT: vzext.vf2 v9, v8, v0.t
238 ; CHECK-NEXT: vmv1r.v v8, v9
240 %v = call <4 x i15> @llvm.vp.zext.v4i15.v4i8(<4 x i8> %va, <4 x i1> %m, i32 %evl)
244 declare <4 x i15> @llvm.vp.zext.v4i15.v4i9(<4 x i9>, <4 x i1>, i32)
246 define <4 x i15> @vzext_v4i15_v4i9(<4 x i9> %va, <4 x i1> %m, i32 zeroext %evl) {
247 ; CHECK-LABEL: vzext_v4i15_v4i9:
249 ; CHECK-NEXT: li a1, 511
250 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
251 ; CHECK-NEXT: vand.vx v8, v8, a1, v0.t
253 %v = call <4 x i15> @llvm.vp.zext.v4i15.v4i9(<4 x i9> %va, <4 x i1> %m, i32 %evl)