Skip to content

Commit 4d57623

Browse files
committed
[RISCV] Use vnclip for scalable vector saturating truncation.
1 parent 84ba7cd commit 4d57623

File tree

4 files changed

+95
-112
lines changed

4 files changed

+95
-112
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,56 @@ defm : VPatBinarySDNode_VV_VX<usubsat, "PseudoVSSUBU">;
11661166
defm : VPatAVGADD_VV_VX_RM<avgflooru, 0b10>;
11671167
defm : VPatAVGADD_VV_VX_RM<avgceilu, 0b00>;
11681168

1169+
// 12.5. Vector Narrowing Fixed-Point Clip Instructions
1170+
class VPatTruncSatClipMaxMinSDNodeBase<VTypeInfo vti,
1171+
VTypeInfo wti,
1172+
SDPatternOperator op1,
1173+
int op1_value,
1174+
SDPatternOperator op2,
1175+
int op2_value> :
1176+
Pat<(vti.Vector (riscv_trunc_vector_vl
1177+
(wti.Vector (op1
1178+
(wti.Vector (op2 (wti.Vector wti.RegClass:$rs1),
1179+
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), op2_value, (XLenVT srcvalue))))),
1180+
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), op1_value, (XLenVT srcvalue))))),
1181+
(vti.Mask V0), VLOpFrag)),
1182+
(!cast<Instruction>("PseudoVNCLIP_WI_"#vti.LMul.MX#"_MASK")
1183+
(vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
1184+
(vti.Mask V0), 0, GPR:$vl, vti.Log2SEW, TA_MA)>;
1185+
1186+
class VPatTruncSatClipUMinSDNode<VTypeInfo vti,
1187+
VTypeInfo wti,
1188+
int uminval> :
1189+
Pat<(vti.Vector (riscv_trunc_vector_vl
1190+
(wti.Vector (umin (wti.Vector wti.RegClass:$rs1),
1191+
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), uminval, (XLenVT srcvalue))))), (vti.Mask V0), VLOpFrag)),
1192+
(!cast<Instruction>("PseudoVNCLIPU_WI_"#vti.LMul.MX#"_MASK")
1193+
(vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
1194+
(vti.Mask V0), 0, GPR:$vl, vti.Log2SEW, TA_MA)>;
1195+
1196+
multiclass VPatTruncSatClipMaxMinSDNode<VTypeInfo vti, VTypeInfo wti,
1197+
SDPatternOperator max, int maxval, SDPatternOperator min, int minval> {
1198+
def : VPatTruncSatClipMaxMinSDNodeBase<vti, wti, max, maxval, min, minval>;
1199+
def : VPatTruncSatClipMaxMinSDNodeBase<vti, wti, min, minval, max, maxval>;
1200+
}
1201+
1202+
multiclass VPatTruncSatClipSDNode<VTypeInfo vti, VTypeInfo wti> {
1203+
defvar sew = vti.SEW;
1204+
defvar uminval = !sub(!shl(1, sew), 1);
1205+
defvar sminval = !sub(!shl(1, !sub(sew, 1)), 1);
1206+
defvar smaxval = !sub(0, !shl(1, !sub(sew, 1)));
1207+
1208+
let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
1209+
GetVTypePredicates<wti>.Predicates) in {
1210+
defm : VPatTruncSatClipMaxMinSDNode<vti, wti, smin, sminval, smax, smaxval>;
1211+
def : VPatTruncSatClipUMinSDNode<vti, wti, uminval>;
1212+
}
1213+
1214+
}
1215+
1216+
foreach vtiToWti = AllWidenableIntVectors in
1217+
defm : VPatTruncSatClipSDNode<vtiToWti.Vti, vtiToWti.Wti>;
1218+
11691219
// 15. Vector Mask Instructions
11701220

11711221
// 15.1. Vector Mask-Register Logical Instructions

llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,13 +2373,12 @@ defm : VPatAVGADDVL_VV_VX_RM<riscv_avgflooru_vl, 0b10>;
23732373
defm : VPatAVGADDVL_VV_VX_RM<riscv_avgceilu_vl, 0b00>;
23742374

23752375
// 12.5. Vector Narrowing Fixed-Point Clip Instructions
2376-
class VPatTruncSatClipMaxMinBase<string inst,
2377-
VTypeInfo vti,
2378-
VTypeInfo wti,
2379-
SDPatternOperator op1,
2380-
int op1_value,
2381-
SDPatternOperator op2,
2382-
int op2_value> :
2376+
class VPatTruncSatClipMaxMinVLBase<VTypeInfo vti,
2377+
VTypeInfo wti,
2378+
SDPatternOperator op1,
2379+
int op1_value,
2380+
SDPatternOperator op2,
2381+
int op2_value> :
23832382
Pat<(vti.Vector (riscv_trunc_vector_vl
23842383
(wti.Vector (op1
23852384
(wti.Vector (op2
@@ -2389,11 +2388,11 @@ class VPatTruncSatClipMaxMinBase<string inst,
23892388
(wti.Vector (riscv_vmv_v_x_vl (wti.Vector undef), op1_value, (XLenVT srcvalue))),
23902389
(wti.Vector undef), (wti.Mask V0), VLOpFrag)),
23912390
(vti.Mask V0), VLOpFrag)),
2392-
(!cast<Instruction>(inst#"_WI_"#vti.LMul.MX#"_MASK")
2391+
(!cast<Instruction>("PseudoVNCLIP_WI_"#vti.LMul.MX#"_MASK")
23932392
(vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
23942393
(vti.Mask V0), 0, GPR:$vl, vti.Log2SEW, TA_MA)>;
23952394

2396-
class VPatTruncSatClipUMin<VTypeInfo vti,
2395+
class VPatTruncSatClipUMinVL<VTypeInfo vti,
23972396
VTypeInfo wti,
23982397
int uminval> :
23992398
Pat<(vti.Vector (riscv_trunc_vector_vl
@@ -2406,29 +2405,28 @@ class VPatTruncSatClipUMin<VTypeInfo vti,
24062405
(vti.Vector (IMPLICIT_DEF)), wti.RegClass:$rs1, 0,
24072406
(vti.Mask V0), 0, GPR:$vl, vti.Log2SEW, TA_MA)>;
24082407

2409-
multiclass VPatTruncSatClipMaxMin<string inst, VTypeInfo vti, VTypeInfo wti,
2408+
multiclass VPatTruncSatClipMaxMinVL<VTypeInfo vti, VTypeInfo wti,
24102409
SDPatternOperator max, int maxval, SDPatternOperator min, int minval> {
2411-
def : VPatTruncSatClipMaxMinBase<inst, vti, wti, max, maxval, min, minval>;
2412-
def : VPatTruncSatClipMaxMinBase<inst, vti, wti, min, minval, max, maxval>;
2410+
def : VPatTruncSatClipMaxMinVLBase<vti, wti, max, maxval, min, minval>;
2411+
def : VPatTruncSatClipMaxMinVLBase<vti, wti, min, minval, max, maxval>;
24132412
}
24142413

2415-
multiclass VPatTruncSatClip<VTypeInfo vti, VTypeInfo wti> {
2414+
multiclass VPatTruncSatClipVL<VTypeInfo vti, VTypeInfo wti> {
24162415
defvar sew = vti.SEW;
24172416
defvar uminval = !sub(!shl(1, sew), 1);
24182417
defvar sminval = !sub(!shl(1, !sub(sew, 1)), 1);
24192418
defvar smaxval = !sub(0, !shl(1, !sub(sew, 1)));
24202419

24212420
let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
24222421
GetVTypePredicates<wti>.Predicates) in {
2423-
defm : VPatTruncSatClipMaxMin<"PseudoVNCLIP", vti, wti, riscv_smin_vl,
2424-
sminval, riscv_smax_vl, smaxval>;
2425-
def : VPatTruncSatClipUMin<vti, wti, uminval>;
2422+
defm : VPatTruncSatClipMaxMinVL<vti, wti, riscv_smin_vl, sminval, riscv_smax_vl, smaxval>;
2423+
def : VPatTruncSatClipUMinVL<vti, wti, uminval>;
24262424
}
24272425

24282426
}
24292427

24302428
foreach vtiToWti = AllWidenableIntVectors in
2431-
defm : VPatTruncSatClip<vtiToWti.Vti, vtiToWti.Wti>;
2429+
defm : VPatTruncSatClipVL<vtiToWti.Vti, vtiToWti.Wti>;
24322430

24332431
// 13. Vector Floating-Point Instructions
24342432

llvm/test/CodeGen/RISCV/rvv/trunc-sat-clip-sdnode.ll

Lines changed: 30 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)