@@ -19,13 +19,8 @@ define void @trunc_sat_i8i16_maxmin(ptr %x, ptr %y) {
1919; CHECK-LABEL: trunc_sat_i8i16_maxmin:
2020; CHECK: # %bb.0:
2121; CHECK-NEXT: vl1re16.v v8, (a0)
22- ; CHECK-NEXT: li a0, -128
23- ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
24- ; CHECK-NEXT: vmax.vx v8, v8, a0
25- ; CHECK-NEXT: li a0, 127
26- ; CHECK-NEXT: vmin.vx v8, v8, a0
27- ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
28- ; CHECK-NEXT: vnsrl.wi v8, v8, 0
22+ ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
23+ ; CHECK-NEXT: vnclip.wi v8, v8, 0
2924; CHECK-NEXT: vse8.v v8, (a1)
3025; CHECK-NEXT: ret
3126 %1 = load <vscale x 4 x i16 >, ptr %x , align 16
@@ -40,13 +35,8 @@ define void @trunc_sat_i8i16_minmax(ptr %x, ptr %y) {
4035; CHECK-LABEL: trunc_sat_i8i16_minmax:
4136; CHECK: # %bb.0:
4237; CHECK-NEXT: vl1re16.v v8, (a0)
43- ; CHECK-NEXT: li a0, 127
44- ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
45- ; CHECK-NEXT: vmin.vx v8, v8, a0
46- ; CHECK-NEXT: li a0, -128
47- ; CHECK-NEXT: vmax.vx v8, v8, a0
48- ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
49- ; CHECK-NEXT: vnsrl.wi v8, v8, 0
38+ ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
39+ ; CHECK-NEXT: vnclip.wi v8, v8, 0
5040; CHECK-NEXT: vse8.v v8, (a1)
5141; CHECK-NEXT: ret
5242 %1 = load <vscale x 4 x i16 >, ptr %x , align 16
@@ -82,11 +72,8 @@ define void @trunc_sat_u8u16_min(ptr %x, ptr %y) {
8272; CHECK-LABEL: trunc_sat_u8u16_min:
8373; CHECK: # %bb.0:
8474; CHECK-NEXT: vl1re16.v v8, (a0)
85- ; CHECK-NEXT: li a0, 255
86- ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
87- ; CHECK-NEXT: vminu.vx v8, v8, a0
88- ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
89- ; CHECK-NEXT: vnsrl.wi v8, v8, 0
75+ ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
76+ ; CHECK-NEXT: vnclipu.wi v8, v8, 0
9077; CHECK-NEXT: vse8.v v8, (a1)
9178; CHECK-NEXT: ret
9279 %1 = load <vscale x 4 x i16 >, ptr %x , align 16
@@ -118,11 +105,8 @@ define void @trunc_sat_u8u16_maxmin(ptr %x, ptr %y) {
118105; CHECK-LABEL: trunc_sat_u8u16_maxmin:
119106; CHECK: # %bb.0:
120107; CHECK-NEXT: vl1re16.v v8, (a0)
121- ; CHECK-NEXT: li a0, 255
122- ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
123- ; CHECK-NEXT: vminu.vx v8, v8, a0
124- ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
125- ; CHECK-NEXT: vnsrl.wi v8, v8, 0
108+ ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
109+ ; CHECK-NEXT: vnclipu.wi v8, v8, 0
126110; CHECK-NEXT: vse8.v v8, (a1)
127111; CHECK-NEXT: ret
128112 %1 = load <vscale x 4 x i16 >, ptr %x , align 16
@@ -137,11 +121,8 @@ define void @trunc_sat_u8u16_minmax(ptr %x, ptr %y) {
137121; CHECK-LABEL: trunc_sat_u8u16_minmax:
138122; CHECK: # %bb.0:
139123; CHECK-NEXT: vl1re16.v v8, (a0)
140- ; CHECK-NEXT: li a0, 255
141- ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
142- ; CHECK-NEXT: vminu.vx v8, v8, a0
143- ; CHECK-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
144- ; CHECK-NEXT: vnsrl.wi v8, v8, 0
124+ ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
125+ ; CHECK-NEXT: vnclipu.wi v8, v8, 0
145126; CHECK-NEXT: vse8.v v8, (a1)
146127; CHECK-NEXT: ret
147128 %1 = load <vscale x 4 x i16 >, ptr %x , align 16
@@ -179,14 +160,8 @@ define void @trunc_sat_i16i32_maxmin(ptr %x, ptr %y) {
179160; CHECK-LABEL: trunc_sat_i16i32_maxmin:
180161; CHECK: # %bb.0:
181162; CHECK-NEXT: vl2re32.v v8, (a0)
182- ; CHECK-NEXT: lui a0, 1048568
183- ; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, ma
184- ; CHECK-NEXT: vmax.vx v8, v8, a0
185- ; CHECK-NEXT: lui a0, 8
186- ; CHECK-NEXT: addi a0, a0, -1
187- ; CHECK-NEXT: vmin.vx v8, v8, a0
188- ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
189- ; CHECK-NEXT: vnsrl.wi v10, v8, 0
163+ ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
164+ ; CHECK-NEXT: vnclip.wi v10, v8, 0
190165; CHECK-NEXT: vs1r.v v10, (a1)
191166; CHECK-NEXT: ret
192167 %1 = load <vscale x 4 x i32 >, ptr %x , align 32
@@ -201,14 +176,8 @@ define void @trunc_sat_i16i32_minmax(ptr %x, ptr %y) {
201176; CHECK-LABEL: trunc_sat_i16i32_minmax:
202177; CHECK: # %bb.0:
203178; CHECK-NEXT: vl2re32.v v8, (a0)
204- ; CHECK-NEXT: lui a0, 8
205- ; CHECK-NEXT: addi a0, a0, -1
206- ; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, ma
207- ; CHECK-NEXT: vmin.vx v8, v8, a0
208- ; CHECK-NEXT: lui a0, 1048568
209- ; CHECK-NEXT: vmax.vx v8, v8, a0
210- ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
211- ; CHECK-NEXT: vnsrl.wi v10, v8, 0
179+ ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
180+ ; CHECK-NEXT: vnclip.wi v10, v8, 0
212181; CHECK-NEXT: vs1r.v v10, (a1)
213182; CHECK-NEXT: ret
214183 %1 = load <vscale x 4 x i32 >, ptr %x , align 32
@@ -242,12 +211,8 @@ define void @trunc_sat_u16u32_min(ptr %x, ptr %y) {
242211; CHECK-LABEL: trunc_sat_u16u32_min:
243212; CHECK: # %bb.0:
244213; CHECK-NEXT: vl2re32.v v8, (a0)
245- ; CHECK-NEXT: lui a0, 16
246- ; CHECK-NEXT: addi a0, a0, -1
247- ; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, ma
248- ; CHECK-NEXT: vminu.vx v8, v8, a0
249- ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
250- ; CHECK-NEXT: vnsrl.wi v10, v8, 0
214+ ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
215+ ; CHECK-NEXT: vnclipu.wi v10, v8, 0
251216; CHECK-NEXT: vs1r.v v10, (a1)
252217; CHECK-NEXT: ret
253218 %1 = load <vscale x 4 x i32 >, ptr %x , align 32
@@ -261,12 +226,8 @@ define void @trunc_sat_u16u32_minmax(ptr %x, ptr %y) {
261226; CHECK-LABEL: trunc_sat_u16u32_minmax:
262227; CHECK: # %bb.0:
263228; CHECK-NEXT: vl2re32.v v8, (a0)
264- ; CHECK-NEXT: lui a0, 16
265- ; CHECK-NEXT: addi a0, a0, -1
266- ; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, ma
267- ; CHECK-NEXT: vminu.vx v8, v8, a0
268- ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
269- ; CHECK-NEXT: vnsrl.wi v10, v8, 0
229+ ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
230+ ; CHECK-NEXT: vnclipu.wi v10, v8, 0
270231; CHECK-NEXT: vs1r.v v10, (a1)
271232; CHECK-NEXT: ret
272233 %1 = load <vscale x 4 x i32 >, ptr %x , align 32
@@ -281,12 +242,8 @@ define void @trunc_sat_u16u32_maxmin(ptr %x, ptr %y) {
281242; CHECK-LABEL: trunc_sat_u16u32_maxmin:
282243; CHECK: # %bb.0:
283244; CHECK-NEXT: vl2re32.v v8, (a0)
284- ; CHECK-NEXT: lui a0, 16
285- ; CHECK-NEXT: addi a0, a0, -1
286- ; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, ma
287- ; CHECK-NEXT: vminu.vx v8, v8, a0
288- ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
289- ; CHECK-NEXT: vnsrl.wi v10, v8, 0
245+ ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
246+ ; CHECK-NEXT: vnclipu.wi v10, v8, 0
290247; CHECK-NEXT: vs1r.v v10, (a1)
291248; CHECK-NEXT: ret
292249 %1 = load <vscale x 4 x i32 >, ptr %x , align 32
@@ -325,13 +282,8 @@ define void @trunc_sat_i32i64_maxmin(ptr %x, ptr %y) {
325282; CHECK-LABEL: trunc_sat_i32i64_maxmin:
326283; CHECK: # %bb.0:
327284; CHECK-NEXT: vl4re64.v v8, (a0)
328- ; CHECK-NEXT: lui a0, 524288
329- ; CHECK-NEXT: vsetvli a2, zero, e64, m4, ta, ma
330- ; CHECK-NEXT: vmax.vx v8, v8, a0
331- ; CHECK-NEXT: addiw a0, a0, -1
332- ; CHECK-NEXT: vmin.vx v8, v8, a0
333- ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
334- ; CHECK-NEXT: vnsrl.wi v12, v8, 0
285+ ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
286+ ; CHECK-NEXT: vnclip.wi v12, v8, 0
335287; CHECK-NEXT: vs2r.v v12, (a1)
336288; CHECK-NEXT: ret
337289 %1 = load <vscale x 4 x i64 >, ptr %x , align 64
@@ -346,13 +298,8 @@ define void @trunc_sat_i32i64_minmax(ptr %x, ptr %y) {
346298; CHECK-LABEL: trunc_sat_i32i64_minmax:
347299; CHECK: # %bb.0:
348300; CHECK-NEXT: vl4re64.v v8, (a0)
349- ; CHECK-NEXT: lui a0, 524288
350- ; CHECK-NEXT: addiw a2, a0, -1
351- ; CHECK-NEXT: vsetvli a3, zero, e64, m4, ta, ma
352- ; CHECK-NEXT: vmin.vx v8, v8, a2
353- ; CHECK-NEXT: vmax.vx v8, v8, a0
354- ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
355- ; CHECK-NEXT: vnsrl.wi v12, v8, 0
301+ ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
302+ ; CHECK-NEXT: vnclip.wi v12, v8, 0
356303; CHECK-NEXT: vs2r.v v12, (a1)
357304; CHECK-NEXT: ret
358305 %1 = load <vscale x 4 x i64 >, ptr %x , align 64
@@ -387,12 +334,8 @@ define void @trunc_sat_u32u64_min(ptr %x, ptr %y) {
387334; CHECK-LABEL: trunc_sat_u32u64_min:
388335; CHECK: # %bb.0:
389336; CHECK-NEXT: vl4re64.v v8, (a0)
390- ; CHECK-NEXT: li a0, -1
391- ; CHECK-NEXT: srli a0, a0, 32
392- ; CHECK-NEXT: vsetvli a2, zero, e64, m4, ta, ma
393- ; CHECK-NEXT: vminu.vx v8, v8, a0
394- ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
395- ; CHECK-NEXT: vnsrl.wi v12, v8, 0
337+ ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
338+ ; CHECK-NEXT: vnclipu.wi v12, v8, 0
396339; CHECK-NEXT: vs2r.v v12, (a1)
397340; CHECK-NEXT: ret
398341 %1 = load <vscale x 4 x i64 >, ptr %x , align 64
@@ -407,12 +350,8 @@ define void @trunc_sat_u32u64_maxmin(ptr %x, ptr %y) {
407350; CHECK-LABEL: trunc_sat_u32u64_maxmin:
408351; CHECK: # %bb.0:
409352; CHECK-NEXT: vl4re64.v v8, (a0)
410- ; CHECK-NEXT: li a0, -1
411- ; CHECK-NEXT: srli a0, a0, 32
412- ; CHECK-NEXT: vsetvli a2, zero, e64, m4, ta, ma
413- ; CHECK-NEXT: vminu.vx v8, v8, a0
414- ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
415- ; CHECK-NEXT: vnsrl.wi v12, v8, 0
353+ ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
354+ ; CHECK-NEXT: vnclipu.wi v12, v8, 0
416355; CHECK-NEXT: vs2r.v v12, (a1)
417356; CHECK-NEXT: ret
418357 %1 = load <vscale x 4 x i64 >, ptr %x , align 64
@@ -427,12 +366,8 @@ define void @trunc_sat_u32u64_minmax(ptr %x, ptr %y) {
427366; CHECK-LABEL: trunc_sat_u32u64_minmax:
428367; CHECK: # %bb.0:
429368; CHECK-NEXT: vl4re64.v v8, (a0)
430- ; CHECK-NEXT: li a0, -1
431- ; CHECK-NEXT: srli a0, a0, 32
432- ; CHECK-NEXT: vsetvli a2, zero, e64, m4, ta, ma
433- ; CHECK-NEXT: vminu.vx v8, v8, a0
434- ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
435- ; CHECK-NEXT: vnsrl.wi v12, v8, 0
369+ ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
370+ ; CHECK-NEXT: vnclipu.wi v12, v8, 0
436371; CHECK-NEXT: vs2r.v v12, (a1)
437372; CHECK-NEXT: ret
438373 %1 = load <vscale x 4 x i64 >, ptr %x , align 64
0 commit comments