Skip to content

Commit 2dd6052

Browse files
committed
Add a vscale test case
1 parent b86f985 commit 2dd6052

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/test/Transforms/InstCombine/vector-reductions.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,16 @@ define i2 @constant_multiplied_7xi2(i2 %0) {
466466
%4 = tail call i2 @llvm.vector.reduce.add.v7i2(<7 x i2> %3)
467467
ret i2 %4
468468
}
469+
470+
define i32 @negative_scalable_vector(i32 %0) {
471+
; CHECK-LABEL: @negative_scalable_vector(
472+
; CHECK-NEXT: [[TMP2:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP0:%.*]], i64 0
473+
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <vscale x 4 x i32> [[TMP2]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
474+
; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> [[TMP3]])
475+
; CHECK-NEXT: ret i32 [[TMP4]]
476+
;
477+
%2 = insertelement <vscale x 4 x i32> poison, i32 %0, i64 0
478+
%3 = shufflevector <vscale x 4 x i32> %2, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
479+
%4 = tail call i32 @llvm.vector.reduce.add.nxv4i32(<vscale x 4 x i32> %3)
480+
ret i32 %4
481+
}

0 commit comments

Comments
 (0)