Skip to content

Commit 0053794

Browse files
committed
[RISCV] Add tests showing incorrect BUILD_VECTOR lowering
These tests both use vector constants misidentified as VID sequences. Because the initial run of elements has a zero step, the elements are skipped until such a step can be identified. The bug is that the skipped elements are never validated, even though the computed step is incompatible across the entire sequence. A fix will follow in a subseqeuent patch. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D123785
1 parent 7f97ac9 commit 0053794

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,3 +723,24 @@ define <8 x i16> @splat_idx_v8i16(<8 x i16> %v, i64 %idx) {
723723
%splat = shufflevector <8 x i16> %ins, <8 x i16> poison, <8 x i32> zeroinitializer
724724
ret <8 x i16> %splat
725725
}
726+
727+
; FIXME: This is not a vid sequence!
728+
define <4 x i8> @buildvec_not_vid_v4i8_1() {
729+
; CHECK-LABEL: buildvec_not_vid_v4i8_1:
730+
; CHECK: # %bb.0:
731+
; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, mu
732+
; CHECK-NEXT: vid.v v8
733+
; CHECK-NEXT: ret
734+
ret <4 x i8> <i8 0, i8 0, i8 2, i8 3>
735+
}
736+
737+
; FIXME: This is not a vid sequence!
738+
define <4 x i8> @buildvec_not_vid_v4i8_2() {
739+
; CHECK-LABEL: buildvec_not_vid_v4i8_2:
740+
; CHECK: # %bb.0:
741+
; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, mu
742+
; CHECK-NEXT: vid.v v8
743+
; CHECK-NEXT: vrsub.vi v8, v8, 3
744+
; CHECK-NEXT: ret
745+
ret <4 x i8> <i8 3, i8 3, i8 1, i8 0>
746+
}

0 commit comments

Comments
 (0)