Skip to content

Commit 21ce6cf

Browse files
frasercrmcktstellar
authored andcommitted
[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 (cherry picked from commit 0053794)
1 parent 58d5fbe commit 21ce6cf

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
@@ -704,3 +704,24 @@ define <8 x i16> @splat_idx_v8i16(<8 x i16> %v, i64 %idx) {
704704
%splat = shufflevector <8 x i16> %ins, <8 x i16> poison, <8 x i32> zeroinitializer
705705
ret <8 x i16> %splat
706706
}
707+
708+
; FIXME: This is not a vid sequence!
709+
define <4 x i8> @buildvec_not_vid_v4i8_1() {
710+
; CHECK-LABEL: buildvec_not_vid_v4i8_1:
711+
; CHECK: # %bb.0:
712+
; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, mu
713+
; CHECK-NEXT: vid.v v8
714+
; CHECK-NEXT: ret
715+
ret <4 x i8> <i8 0, i8 0, i8 2, i8 3>
716+
}
717+
718+
; FIXME: This is not a vid sequence!
719+
define <4 x i8> @buildvec_not_vid_v4i8_2() {
720+
; CHECK-LABEL: buildvec_not_vid_v4i8_2:
721+
; CHECK: # %bb.0:
722+
; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, mu
723+
; CHECK-NEXT: vid.v v8
724+
; CHECK-NEXT: vrsub.vi v8, v8, 3
725+
; CHECK-NEXT: ret
726+
ret <4 x i8> <i8 3, i8 3, i8 1, i8 0>
727+
}

0 commit comments

Comments
 (0)