[PATCH] D123989: [RISCV] Add another test showing incorrect BUILD_VECTOR lowering
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 01:39:54 PDT 2022
frasercrmck created this revision.
frasercrmck added a reviewer: craig.topper.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
This test shows a (contrived) BUILD_VECTOR which is correctly identified
as a sequence of ((vid * -3) / 8) + 5. However, the issue is that using
shift-right for the divide is invalid as the step values are negative.
This patch just adds the test: the fix is added in D123796 <https://reviews.llvm.org/D123796>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123989
Files:
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
Index: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
+++ llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
@@ -745,3 +745,18 @@
; CHECK-NEXT: ret
ret <4 x i8> <i8 3, i8 3, i8 1, i8 0>
}
+
+; FIXME: This is not a valid way to emit this vid sequence: shift-right for
+; division only works for non-negative numbers!
+define <16 x i8> @buildvec_not_vid_v16i8() {
+; CHECK-LABEL: buildvec_not_vid_v16i8:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, mu
+; CHECK-NEXT: vid.v v8
+; CHECK-NEXT: li a0, -3
+; CHECK-NEXT: vmul.vx v8, v8, a0
+; CHECK-NEXT: vsrl.vi v8, v8, 3
+; CHECK-NEXT: vadd.vi v8, v8, 5
+; CHECK-NEXT: ret
+ ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 3, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0>
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123989.423554.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/007791db/attachment.bin>
More information about the llvm-commits
mailing list