Skip to content

Commit fb87e11

Browse files
committed
[RISCV] Add test case for strided scatter with scalar offset. NFC
1 parent 6163775 commit fb87e11

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,26 @@ define void @constant_stride(<vscale x 1 x i64> %x, ptr %p, i64 %stride) {
299299
ret void
300300
}
301301

302+
define <vscale x 1 x i64> @vector_base_scalar_offset(ptr %p, i64 %offset) {
303+
; CHECK-LABEL: @vector_base_scalar_offset(
304+
; CHECK-NEXT: [[STEP:%.*]] = call <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
305+
; CHECK-NEXT: [[PTRS1:%.*]] = getelementptr i64, ptr [[P:%.*]], <vscale x 1 x i64> [[STEP]]
306+
; CHECK-NEXT: [[PTRS2:%.*]] = getelementptr i64, <vscale x 1 x ptr> [[PTRS1]], i64 [[OFFSET:%.*]]
307+
; CHECK-NEXT: [[X:%.*]] = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr> [[PTRS2]], i32 8, <vscale x 1 x i1> shufflevector (<vscale x 1 x i1> insertelement (<vscale x 1 x i1> poison, i1 true, i64 0), <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer), <vscale x 1 x i64> poison)
308+
; CHECK-NEXT: ret <vscale x 1 x i64> [[X]]
309+
;
310+
%step = call <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
311+
%ptrs1 = getelementptr i64, ptr %p, <vscale x 1 x i64> %step
312+
%ptrs2 = getelementptr i64, <vscale x 1 x ptr> %ptrs1, i64 %offset
313+
%x = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(
314+
<vscale x 1 x ptr> %ptrs2,
315+
i32 8,
316+
<vscale x 1 x i1> splat (i1 1),
317+
<vscale x 1 x i64> poison
318+
)
319+
ret <vscale x 1 x i64> %x
320+
}
321+
302322
declare i64 @llvm.vscale.i64()
303323
declare void @llvm.masked.scatter.nxv1i64.nxv1p0(<vscale x 1 x i64>, <vscale x 1 x ptr>, i32, <vscale x 1 x i1>)
304324
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>)

0 commit comments

Comments
 (0)