Skip to content

Commit 94cea8e

Browse files
preameszahiraam
authored andcommitted
[RISCV] Move narrowIndex to be a DAG combine over target independent nodes
In D154687, we added a transform to narrow indexed load/store indices of the form (shl (zext), C). We can move this into a generic transform over the target independent nodes instead, and pick up the fixed vector cases with no additional work required. This is an alternative to D158163. Performing this transform points out that we weren't eliminating zero_extends via the the generic DAG combine. Adjust the (existing) callbacks so that we do. This change *removes* the existing transform on the target specific intrinsic nodes. If anyone has a use case this impacts, please speak up. Note: Reviewed as part of a stack of changes in PR# 66405.
1 parent 6259caf commit 94cea8e

File tree

8 files changed

+375
-371
lines changed

8 files changed

+375
-371
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11632,21 +11632,24 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
1163211632
// zero-extended their indices, \p narrowIndex tries to narrow the type of index
1163311633
// operand if it is matched to pattern (shl (zext x to ty), C) and bits(x) + C <
1163411634
// bits(ty).
11635-
static SDValue narrowIndex(SDValue N, SelectionDAG &DAG) {
11635+
static bool narrowIndex(SDValue &N, ISD::MemIndexType IndexType, SelectionDAG &DAG) {
11636+
if (isIndexTypeSigned(IndexType))
11637+
return false;
11638+
1163611639
if (N.getOpcode() != ISD::SHL || !N->hasOneUse())
11637-
return SDValue();
11640+
return false;
1163811641

1163911642
SDValue N0 = N.getOperand(0);
1164011643
if (N0.getOpcode() != ISD::ZERO_EXTEND &&
1164111644
N0.getOpcode() != RISCVISD::VZEXT_VL)
11642-
return SDValue();
11645+
return false;;
1164311646
if (!N0->hasOneUse())
11644-
return SDValue();
11647+
return false;;
1164511648

1164611649
APInt ShAmt;
1164711650
SDValue N1 = N.getOperand(1);
1164811651
if (!ISD::isConstantSplatVector(N1.getNode(), ShAmt))
11649-
return SDValue();
11652+
return false;;
1165011653

1165111654
SDLoc DL(N);
1165211655
SDValue Src = N0.getOperand(0);
@@ -11658,14 +11661,15 @@ static SDValue narrowIndex(SDValue N, SelectionDAG &DAG) {
1165811661

1165911662
// Skip if NewElen is not narrower than the original extended type.
1166011663
if (NewElen >= N0.getValueType().getScalarSizeInBits())
11661-
return SDValue();
11664+
return false;
1166211665

1166311666
EVT NewEltVT = EVT::getIntegerVT(*DAG.getContext(), NewElen);
1166411667
EVT NewVT = SrcVT.changeVectorElementType(NewEltVT);
1166511668

1166611669
SDValue NewExt = DAG.getNode(N0->getOpcode(), DL, NewVT, N0->ops());
1166711670
SDValue NewShAmtVec = DAG.getConstant(ShAmtV, DL, NewVT);
11668-
return DAG.getNode(ISD::SHL, DL, NewVT, NewExt, NewShAmtVec);
11671+
N = DAG.getNode(ISD::SHL, DL, NewVT, NewExt, NewShAmtVec);
11672+
return true;
1166911673
}
1167011674

1167111675
// Replace (seteq (i64 (and X, 0xffffffff)), C1) with
@@ -13883,6 +13887,13 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1388313887
{MGN->getChain(), MGN->getPassThru(), MGN->getMask(),
1388413888
MGN->getBasePtr(), Index, ScaleOp},
1388513889
MGN->getMemOperand(), IndexType, MGN->getExtensionType());
13890+
13891+
if (narrowIndex(Index, IndexType, DAG))
13892+
return DAG.getMaskedGather(
13893+
N->getVTList(), MGN->getMemoryVT(), DL,
13894+
{MGN->getChain(), MGN->getPassThru(), MGN->getMask(),
13895+
MGN->getBasePtr(), Index, ScaleOp},
13896+
MGN->getMemOperand(), IndexType, MGN->getExtensionType());
1388613897
break;
1388713898
}
1388813899
case ISD::MSCATTER:{
@@ -13900,6 +13911,13 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1390013911
{MSN->getChain(), MSN->getValue(), MSN->getMask(), MSN->getBasePtr(),
1390113912
Index, ScaleOp},
1390213913
MSN->getMemOperand(), IndexType, MSN->isTruncatingStore());
13914+
13915+
if (narrowIndex(Index, IndexType, DAG))
13916+
return DAG.getMaskedScatter(
13917+
N->getVTList(), MSN->getMemoryVT(), DL,
13918+
{MSN->getChain(), MSN->getValue(), MSN->getMask(), MSN->getBasePtr(),
13919+
Index, ScaleOp},
13920+
MSN->getMemOperand(), IndexType, MSN->isTruncatingStore());
1390313921
break;
1390413922
}
1390513923
case ISD::VP_GATHER: {
@@ -13917,6 +13935,14 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1391713935
ScaleOp, VPGN->getMask(),
1391813936
VPGN->getVectorLength()},
1391913937
VPGN->getMemOperand(), IndexType);
13938+
13939+
if (narrowIndex(Index, IndexType, DAG))
13940+
return DAG.getGatherVP(N->getVTList(), VPGN->getMemoryVT(), DL,
13941+
{VPGN->getChain(), VPGN->getBasePtr(), Index,
13942+
ScaleOp, VPGN->getMask(),
13943+
VPGN->getVectorLength()},
13944+
VPGN->getMemOperand(), IndexType);
13945+
1392013946
break;
1392113947
}
1392213948
case ISD::VP_SCATTER: {
@@ -13934,6 +13960,13 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1393413960
VPSN->getBasePtr(), Index, ScaleOp,
1393513961
VPSN->getMask(), VPSN->getVectorLength()},
1393613962
VPSN->getMemOperand(), IndexType);
13963+
13964+
if (narrowIndex(Index, IndexType, DAG))
13965+
return DAG.getScatterVP(N->getVTList(), VPSN->getMemoryVT(), DL,
13966+
{VPSN->getChain(), VPSN->getValue(),
13967+
VPSN->getBasePtr(), Index, ScaleOp,
13968+
VPSN->getMask(), VPSN->getVectorLength()},
13969+
VPSN->getMemOperand(), IndexType);
1393713970
break;
1393813971
}
1393913972
case RISCVISD::SRA_VL:
@@ -14238,23 +14271,6 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
1423814271
return DAG.getConstant(-1, DL, VT);
1423914272
return DAG.getConstant(0, DL, VT);
1424014273
}
14241-
case Intrinsic::riscv_vloxei:
14242-
case Intrinsic::riscv_vloxei_mask:
14243-
case Intrinsic::riscv_vluxei:
14244-
case Intrinsic::riscv_vluxei_mask:
14245-
case Intrinsic::riscv_vsoxei:
14246-
case Intrinsic::riscv_vsoxei_mask:
14247-
case Intrinsic::riscv_vsuxei:
14248-
case Intrinsic::riscv_vsuxei_mask:
14249-
if (SDValue V = narrowIndex(N->getOperand(4), DAG)) {
14250-
SmallVector<SDValue, 8> Ops(N->ops());
14251-
Ops[4] = V;
14252-
const auto *MemSD = cast<MemIntrinsicSDNode>(N);
14253-
return DAG.getMemIntrinsicNode(N->getOpcode(), SDLoc(N), N->getVTList(),
14254-
Ops, MemSD->getMemoryVT(),
14255-
MemSD->getMemOperand());
14256-
}
14257-
return SDValue();
1425814274
}
1425914275
}
1426014276
case ISD::BITCAST: {
@@ -17692,7 +17708,11 @@ Value *RISCVTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(
1769217708

1769317709
bool RISCVTargetLowering::shouldRemoveExtendFromGSIndex(SDValue Extend,
1769417710
EVT DataVT) const {
17695-
return false;
17711+
// We have indexed loads for all legal index types. Indices are always
17712+
// zero extended
17713+
return Extend.getOpcode() == ISD::ZERO_EXTEND &&
17714+
isTypeLegal(Extend.getValueType()) &&
17715+
isTypeLegal(Extend.getOperand(0).getValueType());
1769617716
}
1769717717

1769817718
bool RISCVTargetLowering::shouldConvertFpToSat(unsigned Op, EVT FPVT,

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,21 +1716,19 @@ define <8 x i16> @mgather_baseidx_sext_v8i8_v8i16(ptr %base, <8 x i8> %idxs, <8
17161716
define <8 x i16> @mgather_baseidx_zext_v8i8_v8i16(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x i16> %passthru) {
17171717
; RV32-LABEL: mgather_baseidx_zext_v8i8_v8i16:
17181718
; RV32: # %bb.0:
1719-
; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1720-
; RV32-NEXT: vzext.vf4 v10, v8
1721-
; RV32-NEXT: vadd.vv v10, v10, v10
1719+
; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
1720+
; RV32-NEXT: vwaddu.vv v10, v8, v8
17221721
; RV32-NEXT: vsetvli zero, zero, e16, m1, ta, mu
1723-
; RV32-NEXT: vluxei32.v v9, (a0), v10, v0.t
1722+
; RV32-NEXT: vluxei16.v v9, (a0), v10, v0.t
17241723
; RV32-NEXT: vmv.v.v v8, v9
17251724
; RV32-NEXT: ret
17261725
;
17271726
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8i16:
17281727
; RV64V: # %bb.0:
1729-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1730-
; RV64V-NEXT: vzext.vf8 v12, v8
1731-
; RV64V-NEXT: vadd.vv v12, v12, v12
1728+
; RV64V-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
1729+
; RV64V-NEXT: vwaddu.vv v10, v8, v8
17321730
; RV64V-NEXT: vsetvli zero, zero, e16, m1, ta, mu
1733-
; RV64V-NEXT: vluxei64.v v9, (a0), v12, v0.t
1731+
; RV64V-NEXT: vluxei16.v v9, (a0), v10, v0.t
17341732
; RV64V-NEXT: vmv.v.v v8, v9
17351733
; RV64V-NEXT: ret
17361734
;
@@ -2793,20 +2791,21 @@ define <8 x i32> @mgather_baseidx_sext_v8i8_v8i32(ptr %base, <8 x i8> %idxs, <8
27932791
define <8 x i32> @mgather_baseidx_zext_v8i8_v8i32(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x i32> %passthru) {
27942792
; RV32-LABEL: mgather_baseidx_zext_v8i8_v8i32:
27952793
; RV32: # %bb.0:
2796-
; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, mu
2797-
; RV32-NEXT: vzext.vf4 v12, v8
2798-
; RV32-NEXT: vsll.vi v8, v12, 2
2799-
; RV32-NEXT: vluxei32.v v10, (a0), v8, v0.t
2794+
; RV32-NEXT: vsetivli zero, 8, e16, m1, ta, ma
2795+
; RV32-NEXT: vzext.vf2 v9, v8
2796+
; RV32-NEXT: vsll.vi v8, v9, 2
2797+
; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, mu
2798+
; RV32-NEXT: vluxei16.v v10, (a0), v8, v0.t
28002799
; RV32-NEXT: vmv.v.v v8, v10
28012800
; RV32-NEXT: ret
28022801
;
28032802
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8i32:
28042803
; RV64V: # %bb.0:
2805-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2806-
; RV64V-NEXT: vzext.vf8 v12, v8
2807-
; RV64V-NEXT: vsll.vi v12, v12, 2
2804+
; RV64V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
2805+
; RV64V-NEXT: vzext.vf2 v9, v8
2806+
; RV64V-NEXT: vsll.vi v8, v9, 2
28082807
; RV64V-NEXT: vsetvli zero, zero, e32, m2, ta, mu
2809-
; RV64V-NEXT: vluxei64.v v10, (a0), v12, v0.t
2808+
; RV64V-NEXT: vluxei16.v v10, (a0), v8, v0.t
28102809
; RV64V-NEXT: vmv.v.v v8, v10
28112810
; RV64V-NEXT: ret
28122811
;
@@ -3264,11 +3263,10 @@ define <8 x i32> @mgather_baseidx_zext_v8i16_v8i32(ptr %base, <8 x i16> %idxs, <
32643263
;
32653264
; RV64V-LABEL: mgather_baseidx_zext_v8i16_v8i32:
32663265
; RV64V: # %bb.0:
3267-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
3268-
; RV64V-NEXT: vzext.vf4 v12, v8
3269-
; RV64V-NEXT: vsll.vi v12, v12, 2
3270-
; RV64V-NEXT: vsetvli zero, zero, e32, m2, ta, mu
3271-
; RV64V-NEXT: vluxei64.v v10, (a0), v12, v0.t
3266+
; RV64V-NEXT: vsetivli zero, 8, e32, m2, ta, mu
3267+
; RV64V-NEXT: vzext.vf2 v12, v8
3268+
; RV64V-NEXT: vsll.vi v8, v12, 2
3269+
; RV64V-NEXT: vluxei32.v v10, (a0), v8, v0.t
32723270
; RV64V-NEXT: vmv.v.v v8, v10
32733271
; RV64V-NEXT: ret
32743272
;
@@ -4772,20 +4770,21 @@ define <8 x i64> @mgather_baseidx_sext_v8i8_v8i64(ptr %base, <8 x i8> %idxs, <8
47724770
define <8 x i64> @mgather_baseidx_zext_v8i8_v8i64(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x i64> %passthru) {
47734771
; RV32V-LABEL: mgather_baseidx_zext_v8i8_v8i64:
47744772
; RV32V: # %bb.0:
4775-
; RV32V-NEXT: vsetivli zero, 8, e32, m2, ta, ma
4776-
; RV32V-NEXT: vzext.vf4 v10, v8
4777-
; RV32V-NEXT: vsll.vi v8, v10, 3
4773+
; RV32V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
4774+
; RV32V-NEXT: vzext.vf2 v9, v8
4775+
; RV32V-NEXT: vsll.vi v8, v9, 3
47784776
; RV32V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
4779-
; RV32V-NEXT: vluxei32.v v12, (a0), v8, v0.t
4777+
; RV32V-NEXT: vluxei16.v v12, (a0), v8, v0.t
47804778
; RV32V-NEXT: vmv.v.v v8, v12
47814779
; RV32V-NEXT: ret
47824780
;
47834781
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8i64:
47844782
; RV64V: # %bb.0:
4785-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, mu
4786-
; RV64V-NEXT: vzext.vf8 v16, v8
4787-
; RV64V-NEXT: vsll.vi v8, v16, 3
4788-
; RV64V-NEXT: vluxei64.v v12, (a0), v8, v0.t
4783+
; RV64V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
4784+
; RV64V-NEXT: vzext.vf2 v9, v8
4785+
; RV64V-NEXT: vsll.vi v8, v9, 3
4786+
; RV64V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
4787+
; RV64V-NEXT: vluxei16.v v12, (a0), v8, v0.t
47894788
; RV64V-NEXT: vmv.v.v v8, v12
47904789
; RV64V-NEXT: ret
47914790
;
@@ -5616,10 +5615,11 @@ define <8 x i64> @mgather_baseidx_zext_v8i16_v8i64(ptr %base, <8 x i16> %idxs, <
56165615
;
56175616
; RV64V-LABEL: mgather_baseidx_zext_v8i16_v8i64:
56185617
; RV64V: # %bb.0:
5619-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, mu
5620-
; RV64V-NEXT: vzext.vf4 v16, v8
5621-
; RV64V-NEXT: vsll.vi v8, v16, 3
5622-
; RV64V-NEXT: vluxei64.v v12, (a0), v8, v0.t
5618+
; RV64V-NEXT: vsetivli zero, 8, e32, m2, ta, ma
5619+
; RV64V-NEXT: vzext.vf2 v10, v8
5620+
; RV64V-NEXT: vsll.vi v8, v10, 3
5621+
; RV64V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
5622+
; RV64V-NEXT: vluxei32.v v12, (a0), v8, v0.t
56235623
; RV64V-NEXT: vmv.v.v v8, v12
56245624
; RV64V-NEXT: ret
56255625
;
@@ -7645,21 +7645,19 @@ define <8 x half> @mgather_baseidx_sext_v8i8_v8f16(ptr %base, <8 x i8> %idxs, <8
76457645
define <8 x half> @mgather_baseidx_zext_v8i8_v8f16(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x half> %passthru) {
76467646
; RV32-LABEL: mgather_baseidx_zext_v8i8_v8f16:
76477647
; RV32: # %bb.0:
7648-
; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
7649-
; RV32-NEXT: vzext.vf4 v10, v8
7650-
; RV32-NEXT: vadd.vv v10, v10, v10
7648+
; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
7649+
; RV32-NEXT: vwaddu.vv v10, v8, v8
76517650
; RV32-NEXT: vsetvli zero, zero, e16, m1, ta, mu
7652-
; RV32-NEXT: vluxei32.v v9, (a0), v10, v0.t
7651+
; RV32-NEXT: vluxei16.v v9, (a0), v10, v0.t
76537652
; RV32-NEXT: vmv.v.v v8, v9
76547653
; RV32-NEXT: ret
76557654
;
76567655
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8f16:
76577656
; RV64V: # %bb.0:
7658-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
7659-
; RV64V-NEXT: vzext.vf8 v12, v8
7660-
; RV64V-NEXT: vadd.vv v12, v12, v12
7657+
; RV64V-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
7658+
; RV64V-NEXT: vwaddu.vv v10, v8, v8
76617659
; RV64V-NEXT: vsetvli zero, zero, e16, m1, ta, mu
7662-
; RV64V-NEXT: vluxei64.v v9, (a0), v12, v0.t
7660+
; RV64V-NEXT: vluxei16.v v9, (a0), v10, v0.t
76637661
; RV64V-NEXT: vmv.v.v v8, v9
76647662
; RV64V-NEXT: ret
76657663
;
@@ -8596,20 +8594,21 @@ define <8 x float> @mgather_baseidx_sext_v8i8_v8f32(ptr %base, <8 x i8> %idxs, <
85968594
define <8 x float> @mgather_baseidx_zext_v8i8_v8f32(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x float> %passthru) {
85978595
; RV32-LABEL: mgather_baseidx_zext_v8i8_v8f32:
85988596
; RV32: # %bb.0:
8599-
; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, mu
8600-
; RV32-NEXT: vzext.vf4 v12, v8
8601-
; RV32-NEXT: vsll.vi v8, v12, 2
8602-
; RV32-NEXT: vluxei32.v v10, (a0), v8, v0.t
8597+
; RV32-NEXT: vsetivli zero, 8, e16, m1, ta, ma
8598+
; RV32-NEXT: vzext.vf2 v9, v8
8599+
; RV32-NEXT: vsll.vi v8, v9, 2
8600+
; RV32-NEXT: vsetvli zero, zero, e32, m2, ta, mu
8601+
; RV32-NEXT: vluxei16.v v10, (a0), v8, v0.t
86038602
; RV32-NEXT: vmv.v.v v8, v10
86048603
; RV32-NEXT: ret
86058604
;
86068605
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8f32:
86078606
; RV64V: # %bb.0:
8608-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
8609-
; RV64V-NEXT: vzext.vf8 v12, v8
8610-
; RV64V-NEXT: vsll.vi v12, v12, 2
8607+
; RV64V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
8608+
; RV64V-NEXT: vzext.vf2 v9, v8
8609+
; RV64V-NEXT: vsll.vi v8, v9, 2
86118610
; RV64V-NEXT: vsetvli zero, zero, e32, m2, ta, mu
8612-
; RV64V-NEXT: vluxei64.v v10, (a0), v12, v0.t
8611+
; RV64V-NEXT: vluxei16.v v10, (a0), v8, v0.t
86138612
; RV64V-NEXT: vmv.v.v v8, v10
86148613
; RV64V-NEXT: ret
86158614
;
@@ -9067,11 +9066,10 @@ define <8 x float> @mgather_baseidx_zext_v8i16_v8f32(ptr %base, <8 x i16> %idxs,
90679066
;
90689067
; RV64V-LABEL: mgather_baseidx_zext_v8i16_v8f32:
90699068
; RV64V: # %bb.0:
9070-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, ma
9071-
; RV64V-NEXT: vzext.vf4 v12, v8
9072-
; RV64V-NEXT: vsll.vi v12, v12, 2
9073-
; RV64V-NEXT: vsetvli zero, zero, e32, m2, ta, mu
9074-
; RV64V-NEXT: vluxei64.v v10, (a0), v12, v0.t
9069+
; RV64V-NEXT: vsetivli zero, 8, e32, m2, ta, mu
9070+
; RV64V-NEXT: vzext.vf2 v12, v8
9071+
; RV64V-NEXT: vsll.vi v8, v12, 2
9072+
; RV64V-NEXT: vluxei32.v v10, (a0), v8, v0.t
90759073
; RV64V-NEXT: vmv.v.v v8, v10
90769074
; RV64V-NEXT: ret
90779075
;
@@ -10334,20 +10332,21 @@ define <8 x double> @mgather_baseidx_sext_v8i8_v8f64(ptr %base, <8 x i8> %idxs,
1033410332
define <8 x double> @mgather_baseidx_zext_v8i8_v8f64(ptr %base, <8 x i8> %idxs, <8 x i1> %m, <8 x double> %passthru) {
1033510333
; RV32V-LABEL: mgather_baseidx_zext_v8i8_v8f64:
1033610334
; RV32V: # %bb.0:
10337-
; RV32V-NEXT: vsetivli zero, 8, e32, m2, ta, ma
10338-
; RV32V-NEXT: vzext.vf4 v10, v8
10339-
; RV32V-NEXT: vsll.vi v8, v10, 3
10335+
; RV32V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
10336+
; RV32V-NEXT: vzext.vf2 v9, v8
10337+
; RV32V-NEXT: vsll.vi v8, v9, 3
1034010338
; RV32V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
10341-
; RV32V-NEXT: vluxei32.v v12, (a0), v8, v0.t
10339+
; RV32V-NEXT: vluxei16.v v12, (a0), v8, v0.t
1034210340
; RV32V-NEXT: vmv.v.v v8, v12
1034310341
; RV32V-NEXT: ret
1034410342
;
1034510343
; RV64V-LABEL: mgather_baseidx_zext_v8i8_v8f64:
1034610344
; RV64V: # %bb.0:
10347-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, mu
10348-
; RV64V-NEXT: vzext.vf8 v16, v8
10349-
; RV64V-NEXT: vsll.vi v8, v16, 3
10350-
; RV64V-NEXT: vluxei64.v v12, (a0), v8, v0.t
10345+
; RV64V-NEXT: vsetivli zero, 8, e16, m1, ta, ma
10346+
; RV64V-NEXT: vzext.vf2 v9, v8
10347+
; RV64V-NEXT: vsll.vi v8, v9, 3
10348+
; RV64V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
10349+
; RV64V-NEXT: vluxei16.v v12, (a0), v8, v0.t
1035110350
; RV64V-NEXT: vmv.v.v v8, v12
1035210351
; RV64V-NEXT: ret
1035310352
;
@@ -11001,10 +11000,11 @@ define <8 x double> @mgather_baseidx_zext_v8i16_v8f64(ptr %base, <8 x i16> %idxs
1100111000
;
1100211001
; RV64V-LABEL: mgather_baseidx_zext_v8i16_v8f64:
1100311002
; RV64V: # %bb.0:
11004-
; RV64V-NEXT: vsetivli zero, 8, e64, m4, ta, mu
11005-
; RV64V-NEXT: vzext.vf4 v16, v8
11006-
; RV64V-NEXT: vsll.vi v8, v16, 3
11007-
; RV64V-NEXT: vluxei64.v v12, (a0), v8, v0.t
11003+
; RV64V-NEXT: vsetivli zero, 8, e32, m2, ta, ma
11004+
; RV64V-NEXT: vzext.vf2 v10, v8
11005+
; RV64V-NEXT: vsll.vi v8, v10, 3
11006+
; RV64V-NEXT: vsetvli zero, zero, e64, m4, ta, mu
11007+
; RV64V-NEXT: vluxei32.v v12, (a0), v8, v0.t
1100811008
; RV64V-NEXT: vmv.v.v v8, v12
1100911009
; RV64V-NEXT: ret
1101011010
;

0 commit comments

Comments
 (0)