Skip to content

Commit 09e4d3e

Browse files
Swapped condition to handle cases where one vector is scalable and the other is fixed
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 984c3cc commit 09e4d3e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,8 +3509,8 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
35093509
if (Idx.getValueType() != Subtarget.getXLenVT())
35103510
return SDValue();
35113511

3512-
if (Vec.getValueSizeInBits().getKnownMinValue() >
3513-
VT.getSizeInBits().getKnownMinValue())
3512+
// FIXME: Can we use the indexes that are in-bound here instead?
3513+
if (!TypeSize::isKnownLE(Vec.getValueSizeInBits(), VT.getSizeInBits()))
35143514
return SDValue();
35153515

35163516
MVT ContainerVT = VT;

llvm/test/CodeGen/RISCV/rvv/intrinsic-vector-match.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ define <vscale x 16 x i1> @match_nxv16i8_v16i8(<vscale x 16 x i8> %op1, <16 x i8
143143
define <16 x i1> @match_v16i8_v1i8(<16 x i8> %op1, <1 x i8> %op2, <16 x i1> %mask) {
144144
; CHECK-LABEL: match_v16i8_v1i8:
145145
; CHECK: # %bb.0:
146-
; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
146+
; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
147147
; CHECK-NEXT: vrgather.vi v10, v9, 0
148+
; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
148149
; CHECK-NEXT: vmseq.vv v8, v8, v10
149150
; CHECK-NEXT: vmand.mm v0, v8, v0
150151
; CHECK-NEXT: ret

0 commit comments

Comments
 (0)