Skip to content

Commit 3b3ee1f

Browse files
committed
[RISCV] Add test for strided gather with disjoint or. NFC
1 parent 731b295 commit 3b3ee1f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@ define <vscale x 1 x i64> @straightline_offset_add(ptr %p, i64 %offset) {
129129
ret <vscale x 1 x i64> %x
130130
}
131131

132+
define <vscale x 1 x i64> @straightline_offset_disjoint_or(ptr %p, i64 %offset) {
133+
; CHECK-LABEL: @straightline_offset_disjoint_or(
134+
; CHECK-NEXT: [[STEP:%.*]] = call <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
135+
; CHECK-NEXT: [[STEP_SHL:%.*]] = shl <vscale x 1 x i64> [[STEP]], shufflevector (<vscale x 1 x i64> insertelement (<vscale x 1 x i64> poison, i64 1, i32 0), <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer)
136+
; CHECK-NEXT: [[OFFSETV:%.*]] = or disjoint <vscale x 1 x i64> [[STEP_SHL]], shufflevector (<vscale x 1 x i64> insertelement (<vscale x 1 x i64> poison, i64 1, i32 0), <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer)
137+
; CHECK-NEXT: [[PTRS:%.*]] = getelementptr i32, ptr [[P:%.*]], <vscale x 1 x i64> [[OFFSETV]]
138+
; CHECK-NEXT: [[X:%.*]] = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(<vscale x 1 x ptr> [[PTRS]], 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)
139+
; CHECK-NEXT: ret <vscale x 1 x i64> [[X]]
140+
;
141+
%step = call <vscale x 1 x i64> @llvm.experimental.stepvector.nxv1i64()
142+
%step.shl = shl <vscale x 1 x i64> %step, shufflevector (<vscale x 1 x i64> insertelement (<vscale x 1 x i64> poison, i64 1, i32 0), <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer)
143+
%offsetv = or disjoint <vscale x 1 x i64> %step.shl, shufflevector (<vscale x 1 x i64> insertelement (<vscale x 1 x i64> poison, i64 1, i32 0), <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer)
144+
%ptrs = getelementptr i32, ptr %p, <vscale x 1 x i64> %offsetv
145+
%x = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(
146+
<vscale x 1 x ptr> %ptrs,
147+
i32 8,
148+
<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),
149+
<vscale x 1 x i64> poison
150+
)
151+
ret <vscale x 1 x i64> %x
152+
}
153+
132154
define <vscale x 1 x i64> @straightline_offset_shl(ptr %p) {
133155
; CHECK-LABEL: @straightline_offset_shl(
134156
; CHECK-NEXT: [[X:%.*]] = call <vscale x 1 x i64> @llvm.riscv.masked.strided.load.nxv1i64.p0.i64(<vscale x 1 x i64> poison, ptr [[P:%.*]], i64 32, <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))

0 commit comments

Comments
 (0)