[llvm] [RISCV] Allow larger offset when matching build_vector as vid sequence (PR #144756)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 19 16:19:48 PDT 2025
================
@@ -94,21 +94,25 @@ define <2 x bfloat> @vid_v2bf16() {
define <2 x bfloat> @vid_addend1_v2bf16() {
; CHECK-LABEL: vid_addend1_v2bf16:
; CHECK: # %bb.0:
-; CHECK-NEXT: lui a0, 262148
+; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
+; CHECK-NEXT: vid.v v8
+; CHECK-NEXT: lui a0, 4
+; CHECK-NEXT: vsll.vi v8, v8, 7
; CHECK-NEXT: addi a0, a0, -128
-; CHECK-NEXT: vsetivli zero, 2, e32, m1, ta, ma
-; CHECK-NEXT: vmv.s.x v8, a0
+; CHECK-NEXT: vadd.vx v8, v8, a0
----------------
preames wrote:
It is a regression, I don't particularly consider it a serious one. The nature type here is 2 x e16, so we're trading no-VTYPE toggle for 3 vector ops and 2 scalar op (instead of 1 and 2). So a net increase of two vector ops for one vtype togggle in a cornercase. As mentioned in the review, this is hard to avoid without really restructuring the code.
I don't think this is significant given 2 element vectorization is pretty rare to start with.
Am I missing something?
https://github.com/llvm/llvm-project/pull/144756
More information about the llvm-commits
mailing list