Skip to content

Commit 203b35d

Browse files
authored
[NFC] Precommit test for "[RISCV] Create disjoint or in RISCVGatherScatterLowering" (#152068)
#151981
1 parent d02714c commit 203b35d

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ define <vscale x 1 x i64> @straightline_offset_add(ptr %p, i64 %offset) {
443443
ret <vscale x 1 x i64> %x
444444
}
445445

446-
define <vscale x 1 x i64> @straightline_offset_disjoint_or(ptr %p, i64 %offset) {
447-
; CHECK-LABEL: @straightline_offset_disjoint_or(
446+
define <vscale x 1 x i64> @straightline_offset_disjoint_or_1(ptr %p) {
447+
; CHECK-LABEL: @straightline_offset_disjoint_or_1(
448448
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 1
449449
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @llvm.vscale.i32()
450450
; CHECK-NEXT: [[TMP3:%.*]] = call <vscale x 1 x i64> @llvm.experimental.vp.strided.load.nxv1i64.p0.i64(ptr [[TMP1]], i64 8, <vscale x 1 x i1> splat (i1 true), i32 [[TMP2]])
@@ -464,6 +464,33 @@ define <vscale x 1 x i64> @straightline_offset_disjoint_or(ptr %p, i64 %offset)
464464
ret <vscale x 1 x i64> %x
465465
}
466466

467+
define <vscale x 1 x i64> @straightline_offset_disjoint_or(ptr %p, i1 %offset) {
468+
; CHECK-LABEL: @straightline_offset_disjoint_or(
469+
; CHECK-NEXT: [[AND:%.*]] = zext i1 [[OFFSET:%.*]] to i64
470+
; CHECK-NEXT: [[TMP4:%.*]] = add i64 4, [[AND]]
471+
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i32, ptr [[P:%.*]], i64 [[TMP4]]
472+
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @llvm.vscale.i32()
473+
; CHECK-NEXT: [[TMP3:%.*]] = call <vscale x 1 x i64> @llvm.experimental.vp.strided.load.nxv1i64.p0.i64(ptr [[TMP1]], i64 8, <vscale x 1 x i1> splat (i1 true), i32 [[TMP2]])
474+
; CHECK-NEXT: [[X:%.*]] = call <vscale x 1 x i64> @llvm.vp.select.nxv1i64(<vscale x 1 x i1> splat (i1 true), <vscale x 1 x i64> [[TMP3]], <vscale x 1 x i64> poison, i32 [[TMP2]])
475+
; CHECK-NEXT: ret <vscale x 1 x i64> [[X]]
476+
;
477+
%step = call <vscale x 1 x i64> @llvm.stepvector.nxv1i64()
478+
%step.shl = shl <vscale x 1 x i64> %step, splat (i64 1)
479+
%add = add <vscale x 1 x i64> %step.shl, splat (i64 4)
480+
%zext = zext i1 %offset to i64
481+
%splat.insert = insertelement <vscale x 1 x i64> poison, i64 %zext, i64 0
482+
%splat = shufflevector <vscale x 1 x i64> %splat.insert, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
483+
%offsetv = or disjoint <vscale x 1 x i64> %add, %splat
484+
%ptrs = getelementptr i32, ptr %p, <vscale x 1 x i64> %offsetv
485+
%x = call <vscale x 1 x i64> @llvm.masked.gather.nxv1i64.nxv1p0(
486+
<vscale x 1 x ptr> %ptrs,
487+
i32 8,
488+
<vscale x 1 x i1> splat (i1 true),
489+
<vscale x 1 x i64> poison
490+
)
491+
ret <vscale x 1 x i64> %x
492+
}
493+
467494
define <vscale x 1 x i64> @straightline_offset_shl(ptr %p) {
468495
; CHECK-LABEL: @straightline_offset_shl(
469496
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.vscale.i32()

0 commit comments

Comments
 (0)