Skip to content

Commit 25c0978

Browse files
committed
Precommit test
1 parent b0e05a5 commit 25c0978

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/strided-load-store.ll

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,61 @@ define <vscale x 1 x i64> @vector_base_vector_offset(ptr %p, <vscale x 1 x i64>
398398
declare i64 @llvm.vscale.i64()
399399
declare void @llvm.masked.scatter.nxv1i64.nxv1p0(<vscale x 1 x i64>, <vscale x 1 x ptr>, i32, <vscale x 1 x i1>)
400400
declare <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr>, i32, <vscale x 1 x i1>, <vscale x 1 x i64>)
401+
402+
define <vscale x 1 x i64> @gather_loop_variant_step(ptr %a, i32 %len) {
403+
; CHECK-LABEL: @gather_loop_variant_step(
404+
; CHECK-NEXT: vector.ph:
405+
; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[LEN:%.*]] to i64
406+
; CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 1 x i64> @llvm.stepvector.nxv1i64()
407+
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
408+
; CHECK: vector.body:
409+
; CHECK-NEXT: [[VEC_IND_SCALAR:%.*]] = phi i64 [ 0, [[VECTOR_PH:%.*]] ], [ [[VEC_IND_NEXT_SCALAR:%.*]], [[VECTOR_BODY]] ]
410+
; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 1 x i64> [ [[TMP0]], [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
411+
; CHECK-NEXT: [[ACCUM:%.*]] = phi <vscale x 1 x i64> [ zeroinitializer, [[VECTOR_PH]] ], [ [[ACCUM_NEXT:%.*]], [[VECTOR_BODY]] ]
412+
; CHECK-NEXT: [[ELEMS:%.*]] = sub i64 [[WIDE_TRIP_COUNT]], [[VEC_IND_SCALAR]]
413+
; CHECK-NEXT: [[EVL:%.*]] = call i32 @llvm.experimental.get.vector.length.i64(i64 [[ELEMS]], i32 1, i1 true)
414+
; CHECK-NEXT: [[EVL_ZEXT:%.*]] = zext i32 [[EVL]] to i64
415+
; CHECK-NEXT: [[OFFSET:%.*]] = shl <vscale x 1 x i64> [[VEC_IND]], splat (i64 4)
416+
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_FOO:%.*]], ptr [[A:%.*]], <vscale x 1 x i64> [[OFFSET]], i32 3
417+
; CHECK-NEXT: [[GATHER:%.*]] = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr> [[TMP1]], i32 8, <vscale x 1 x i1> splat (i1 true), <vscale x 1 x i64> undef)
418+
; CHECK-NEXT: [[ACCUM_NEXT]] = add <vscale x 1 x i64> [[ACCUM]], [[GATHER]]
419+
; CHECK-NEXT: [[VEC_IND_NEXT_SCALAR]] = add nuw i64 [[VEC_IND_SCALAR]], [[EVL_ZEXT]]
420+
; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 1 x i64> poison, i64 [[EVL_ZEXT]], i64 0
421+
; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 1 x i64> [[DOTSPLATINSERT]], <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
422+
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <vscale x 1 x i64> [[VEC_IND]], [[DOTSPLAT]]
423+
; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i64 [[VEC_IND_NEXT_SCALAR]], [[WIDE_TRIP_COUNT]]
424+
; CHECK-NEXT: br i1 [[TMP3]], label [[FOR_COND_CLEANUP:%.*]], label [[VECTOR_BODY]]
425+
; CHECK: for.cond.cleanup:
426+
; CHECK-NEXT: ret <vscale x 1 x i64> [[ACCUM_NEXT]]
427+
;
428+
vector.ph:
429+
%wide.trip.count = zext i32 %len to i64
430+
%1 = tail call <vscale x 1 x i64> @llvm.stepvector.nxv1i64()
431+
br label %vector.body
432+
433+
vector.body: ; preds = %vector.body, %vector.ph
434+
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
435+
%vec.ind = phi <vscale x 1 x i64> [ %1, %vector.ph ], [ %vec.ind.next, %vector.body ]
436+
%accum = phi <vscale x 1 x i64> [ zeroinitializer, %vector.ph ], [ %accum.next, %vector.body ]
437+
438+
%elems = sub i64 %wide.trip.count, %index
439+
%evl = call i32 @llvm.experimental.get.vector.length(i64 %elems, i32 1, i1 true)
440+
%evl.zext = zext i32 %evl to i64
441+
442+
%offset = shl <vscale x 1 x i64> %vec.ind, splat (i64 4)
443+
%2 = getelementptr inbounds %struct.foo, ptr %a, <vscale x 1 x i64> %offset, i32 3
444+
%gather = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr> %2, i32 8, <vscale x 1 x i1> splat (i1 true), <vscale x 1 x i64> undef)
445+
%accum.next = add <vscale x 1 x i64> %accum, %gather
446+
447+
%index.next = add nuw i64 %index, %evl.zext
448+
449+
%.splatinsert = insertelement <vscale x 1 x i64> poison, i64 %evl.zext, i64 0
450+
%.splat = shufflevector <vscale x 1 x i64> %.splatinsert, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
451+
%vec.ind.next = add <vscale x 1 x i64> %vec.ind, %.splat
452+
453+
%3 = icmp ne i64 %index.next, %wide.trip.count
454+
br i1 %3, label %for.cond.cleanup, label %vector.body
455+
456+
for.cond.cleanup: ; preds = %vector.body
457+
ret <vscale x 1 x i64> %accum.next
458+
}

0 commit comments

Comments
 (0)