Skip to content

Commit af82d01

Browse files
committed
Reapply "[RISCV] Separate doLocalPostpass into new pass and move to post vector regalloc (#88295)"
The original commit was calling shrinkToUses on an interval for a virtual register whose def was erased. This fixes it by calling shrinkToUses first and removing the interval if we erase the old VL def.
1 parent 80f510b commit af82d01

36 files changed

+1283
-1358
lines changed

llvm/lib/Target/RISCV/RISCV.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ void initializeRISCVExpandAtomicPseudoPass(PassRegistry &);
6161
FunctionPass *createRISCVInsertVSETVLIPass();
6262
void initializeRISCVInsertVSETVLIPass(PassRegistry &);
6363

64+
FunctionPass *createRISCVCoalesceVSETVLIPass();
65+
void initializeRISCVCoalesceVSETVLIPass(PassRegistry &);
66+
6467
FunctionPass *createRISCVPostRAExpandPseudoPass();
6568
void initializeRISCVPostRAExpandPseudoPass(PassRegistry &);
6669
FunctionPass *createRISCVInsertReadWriteCSRPass();

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 112 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@
2727
#include "RISCV.h"
2828
#include "RISCVSubtarget.h"
2929
#include "llvm/ADT/Statistic.h"
30+
#include "llvm/CodeGen/LiveDebugVariables.h"
3031
#include "llvm/CodeGen/LiveIntervals.h"
32+
#include "llvm/CodeGen/LiveStacks.h"
3133
#include "llvm/CodeGen/MachineFunctionPass.h"
3234
#include <queue>
3335
using namespace llvm;
3436

3537
#define DEBUG_TYPE "riscv-insert-vsetvli"
3638
#define RISCV_INSERT_VSETVLI_NAME "RISC-V Insert VSETVLI pass"
39+
#define RISCV_COALESCE_VSETVLI_NAME "RISC-V Coalesce VSETVLI pass"
3740

3841
STATISTIC(NumInsertedVSETVL, "Number of VSETVL inst inserted");
39-
STATISTIC(NumRemovedVSETVL, "Number of VSETVL inst removed");
42+
STATISTIC(NumCoalescedVSETVL, "Number of VSETVL inst coalesced");
4043

4144
static cl::opt<bool> DisableInsertVSETVLPHIOpt(
4245
"riscv-disable-insert-vsetvl-phi-opt", cl::init(false), cl::Hidden,
@@ -190,6 +193,11 @@ static bool hasUndefinedMergeOp(const MachineInstr &MI,
190193
if (UseMO.getReg() == RISCV::NoRegister)
191194
return true;
192195

196+
if (UseMO.isUndef())
197+
return true;
198+
if (UseMO.getReg().isPhysical())
199+
return false;
200+
193201
if (MachineInstr *UseMI = MRI.getVRegDef(UseMO.getReg())) {
194202
if (UseMI->isImplicitDef())
195203
return true;
@@ -780,18 +788,52 @@ class RISCVInsertVSETVLI : public MachineFunctionPass {
780788
VSETVLIInfo &Info) const;
781789
void computeIncomingVLVTYPE(const MachineBasicBlock &MBB);
782790
void emitVSETVLIs(MachineBasicBlock &MBB);
783-
void doLocalPostpass(MachineBasicBlock &MBB);
784791
void doPRE(MachineBasicBlock &MBB);
785792
void insertReadVL(MachineBasicBlock &MBB);
786793
};
787794

795+
class RISCVCoalesceVSETVLI : public MachineFunctionPass {
796+
public:
797+
static char ID;
798+
const RISCVSubtarget *ST;
799+
const TargetInstrInfo *TII;
800+
MachineRegisterInfo *MRI;
801+
LiveIntervals *LIS;
802+
803+
RISCVCoalesceVSETVLI() : MachineFunctionPass(ID) {}
804+
bool runOnMachineFunction(MachineFunction &MF) override;
805+
806+
void getAnalysisUsage(AnalysisUsage &AU) const override {
807+
AU.setPreservesCFG();
808+
809+
AU.addRequired<LiveIntervals>();
810+
AU.addPreserved<LiveIntervals>();
811+
AU.addRequired<SlotIndexes>();
812+
AU.addPreserved<SlotIndexes>();
813+
AU.addPreserved<LiveDebugVariables>();
814+
AU.addPreserved<LiveStacks>();
815+
816+
MachineFunctionPass::getAnalysisUsage(AU);
817+
}
818+
819+
StringRef getPassName() const override { return RISCV_COALESCE_VSETVLI_NAME; }
820+
821+
private:
822+
bool coalesceVSETVLIs(MachineBasicBlock &MBB);
823+
};
824+
788825
} // end anonymous namespace
789826

790827
char RISCVInsertVSETVLI::ID = 0;
791828

792829
INITIALIZE_PASS(RISCVInsertVSETVLI, DEBUG_TYPE, RISCV_INSERT_VSETVLI_NAME,
793830
false, false)
794831

832+
char RISCVCoalesceVSETVLI::ID = 0;
833+
834+
INITIALIZE_PASS(RISCVCoalesceVSETVLI, "riscv-coalesce-vsetvli",
835+
RISCV_COALESCE_VSETVLI_NAME, false, false)
836+
795837
// Return a VSETVLIInfo representing the changes made by this VSETVLI or
796838
// VSETIVLI instruction.
797839
static VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI) {
@@ -1515,12 +1557,12 @@ static bool canMutatePriorConfig(const MachineInstr &PrevMI,
15151557

15161558
auto &AVL = MI.getOperand(1);
15171559
auto &PrevAVL = PrevMI.getOperand(1);
1518-
assert(MRI.isSSA());
15191560

15201561
// If the AVL is a register, we need to make sure MI's AVL dominates PrevMI.
15211562
// For now just check that PrevMI uses the same virtual register.
15221563
if (AVL.isReg() && AVL.getReg() != RISCV::X0 &&
1523-
(!PrevAVL.isReg() || PrevAVL.getReg() != AVL.getReg()))
1564+
(!MRI.hasOneDef(AVL.getReg()) || !PrevAVL.isReg() ||
1565+
PrevAVL.getReg() != AVL.getReg()))
15241566
return false;
15251567
}
15261568

@@ -1530,7 +1572,7 @@ static bool canMutatePriorConfig(const MachineInstr &PrevMI,
15301572
return areCompatibleVTYPEs(PriorVType, VType, Used);
15311573
}
15321574

1533-
void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
1575+
bool RISCVCoalesceVSETVLI::coalesceVSETVLIs(MachineBasicBlock &MBB) {
15341576
MachineInstr *NextMI = nullptr;
15351577
// We can have arbitrary code in successors, so VL and VTYPE
15361578
// must be considered demanded.
@@ -1563,20 +1605,50 @@ void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
15631605

15641606
if (canMutatePriorConfig(MI, *NextMI, Used, *MRI)) {
15651607
if (!isVLPreservingConfig(*NextMI)) {
1566-
MI.getOperand(0).setReg(NextMI->getOperand(0).getReg());
1608+
Register DefReg = NextMI->getOperand(0).getReg();
1609+
1610+
MI.getOperand(0).setReg(DefReg);
15671611
MI.getOperand(0).setIsDead(false);
1612+
1613+
// The def of DefReg moved to MI, so extend the LiveInterval up to
1614+
// it.
1615+
if (DefReg.isVirtual()) {
1616+
LiveInterval &DefLI = LIS->getInterval(DefReg);
1617+
SlotIndex MISlot = LIS->getInstructionIndex(MI).getRegSlot();
1618+
VNInfo *DefVNI = DefLI.getVNInfoAt(DefLI.beginIndex());
1619+
LiveInterval::Segment S(MISlot, DefLI.beginIndex(), DefVNI);
1620+
DefLI.addSegment(S);
1621+
DefVNI->def = MISlot;
1622+
// Mark DefLI as spillable if it was previously unspillable
1623+
DefLI.setWeight(0);
1624+
1625+
// DefReg may have had no uses, in which case we need to shrink
1626+
// the LiveInterval up to MI.
1627+
LIS->shrinkToUses(&DefLI);
1628+
}
1629+
15681630
Register OldVLReg;
15691631
if (MI.getOperand(1).isReg())
15701632
OldVLReg = MI.getOperand(1).getReg();
15711633
if (NextMI->getOperand(1).isImm())
15721634
MI.getOperand(1).ChangeToImmediate(NextMI->getOperand(1).getImm());
15731635
else
15741636
MI.getOperand(1).ChangeToRegister(NextMI->getOperand(1).getReg(), false);
1575-
if (OldVLReg) {
1637+
1638+
// Clear NextMI's AVL early so we're not counting it as a use.
1639+
if (NextMI->getOperand(1).isReg())
1640+
NextMI->getOperand(1).setReg(RISCV::NoRegister);
1641+
1642+
if (OldVLReg && OldVLReg.isVirtual()) {
1643+
// NextMI no longer uses OldVLReg so shrink its LiveInterval.
1644+
LIS->shrinkToUses(&LIS->getInterval(OldVLReg));
1645+
15761646
MachineInstr *VLOpDef = MRI->getUniqueVRegDef(OldVLReg);
15771647
if (VLOpDef && TII->isAddImmediate(*VLOpDef, OldVLReg) &&
1578-
MRI->use_nodbg_empty(OldVLReg))
1648+
MRI->use_nodbg_empty(OldVLReg)) {
15791649
VLOpDef->eraseFromParent();
1650+
LIS->removeInterval(OldVLReg);
1651+
}
15801652
}
15811653
MI.setDesc(NextMI->getDesc());
15821654
}
@@ -1589,9 +1661,13 @@ void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
15891661
Used = getDemanded(MI, MRI, ST);
15901662
}
15911663

1592-
NumRemovedVSETVL += ToDelete.size();
1593-
for (auto *MI : ToDelete)
1664+
NumCoalescedVSETVL += ToDelete.size();
1665+
for (auto *MI : ToDelete) {
1666+
LIS->RemoveMachineInstrFromMaps(*MI);
15941667
MI->eraseFromParent();
1668+
}
1669+
1670+
return !ToDelete.empty();
15951671
}
15961672

15971673
void RISCVInsertVSETVLI::insertReadVL(MachineBasicBlock &MBB) {
@@ -1666,15 +1742,6 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) {
16661742
for (MachineBasicBlock &MBB : MF)
16671743
emitVSETVLIs(MBB);
16681744

1669-
// Now that all vsetvlis are explicit, go through and do block local
1670-
// DSE and peephole based demanded fields based transforms. Note that
1671-
// this *must* be done outside the main dataflow so long as we allow
1672-
// any cross block analysis within the dataflow. We can't have both
1673-
// demanded fields based mutation and non-local analysis in the
1674-
// dataflow at the same time without introducing inconsistencies.
1675-
for (MachineBasicBlock &MBB : MF)
1676-
doLocalPostpass(MBB);
1677-
16781745
// Insert PseudoReadVL after VLEFF/VLSEGFF and replace it with the vl output
16791746
// of VLEFF/VLSEGFF.
16801747
for (MachineBasicBlock &MBB : MF)
@@ -1688,3 +1755,29 @@ bool RISCVInsertVSETVLI::runOnMachineFunction(MachineFunction &MF) {
16881755
FunctionPass *llvm::createRISCVInsertVSETVLIPass() {
16891756
return new RISCVInsertVSETVLI();
16901757
}
1758+
1759+
// Now that all vsetvlis are explicit, go through and do block local
1760+
// DSE and peephole based demanded fields based transforms. Note that
1761+
// this *must* be done outside the main dataflow so long as we allow
1762+
// any cross block analysis within the dataflow. We can't have both
1763+
// demanded fields based mutation and non-local analysis in the
1764+
// dataflow at the same time without introducing inconsistencies.
1765+
bool RISCVCoalesceVSETVLI::runOnMachineFunction(MachineFunction &MF) {
1766+
// Skip if the vector extension is not enabled.
1767+
ST = &MF.getSubtarget<RISCVSubtarget>();
1768+
if (!ST->hasVInstructions())
1769+
return false;
1770+
TII = ST->getInstrInfo();
1771+
MRI = &MF.getRegInfo();
1772+
LIS = &getAnalysis<LiveIntervals>();
1773+
1774+
bool Changed = false;
1775+
for (MachineBasicBlock &MBB : MF)
1776+
Changed |= coalesceVSETVLIs(MBB);
1777+
1778+
return Changed;
1779+
}
1780+
1781+
FunctionPass *llvm::createRISCVCoalesceVSETVLIPass() {
1782+
return new RISCVCoalesceVSETVLI();
1783+
}

llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
116116
initializeRISCVExpandPseudoPass(*PR);
117117
initializeRISCVFoldMasksPass(*PR);
118118
initializeRISCVInsertVSETVLIPass(*PR);
119+
initializeRISCVCoalesceVSETVLIPass(*PR);
119120
initializeRISCVInsertReadWriteCSRPass(*PR);
120121
initializeRISCVInsertWriteVXRMPass(*PR);
121122
initializeRISCVDAGToDAGISelPass(*PR);
@@ -388,12 +389,14 @@ FunctionPass *RISCVPassConfig::createRVVRegAllocPass(bool Optimized) {
388389

389390
bool RISCVPassConfig::addRegAssignAndRewriteFast() {
390391
addPass(createRVVRegAllocPass(false));
392+
addPass(createRISCVCoalesceVSETVLIPass());
391393
return TargetPassConfig::addRegAssignAndRewriteFast();
392394
}
393395

394396
bool RISCVPassConfig::addRegAssignAndRewriteOptimized() {
395397
addPass(createRVVRegAllocPass(true));
396398
addPass(createVirtRegRewriter(false));
399+
addPass(createRISCVCoalesceVSETVLIPass());
397400
return TargetPassConfig::addRegAssignAndRewriteOptimized();
398401
}
399402

llvm/test/CodeGen/RISCV/O0-pipeline.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
; CHECK-NEXT: Eliminate PHI nodes for register allocation
4848
; CHECK-NEXT: Two-Address instruction pass
4949
; CHECK-NEXT: Fast Register Allocator
50+
; CHECK-NEXT: MachineDominator Tree Construction
51+
; CHECK-NEXT: Slot index numbering
52+
; CHECK-NEXT: Live Interval Analysis
53+
; CHECK-NEXT: RISC-V Coalesce VSETVLI pass
5054
; CHECK-NEXT: Fast Register Allocator
5155
; CHECK-NEXT: Remove Redundant DEBUG_VALUE analysis
5256
; CHECK-NEXT: Fixup Statepoint Caller Saved

llvm/test/CodeGen/RISCV/O3-pipeline.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
; CHECK-NEXT: Machine Optimization Remark Emitter
144144
; CHECK-NEXT: Greedy Register Allocator
145145
; CHECK-NEXT: Virtual Register Rewriter
146+
; CHECK-NEXT: RISC-V Coalesce VSETVLI pass
146147
; CHECK-NEXT: Virtual Register Map
147148
; CHECK-NEXT: Live Register Matrix
148149
; CHECK-NEXT: Greedy Register Allocator

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,8 @@ define <8 x float> @buildvec_v8f32_zvl256(float %e0, float %e1, float %e2, float
14071407
; CHECK-NEXT: vfmv.v.f v8, fa4
14081408
; CHECK-NEXT: vfslide1down.vf v8, v8, fa5
14091409
; CHECK-NEXT: vfslide1down.vf v8, v8, fa6
1410-
; CHECK-NEXT: vmv.v.i v0, 15
14111410
; CHECK-NEXT: vfslide1down.vf v8, v8, fa7
1411+
; CHECK-NEXT: vmv.v.i v0, 15
14121412
; CHECK-NEXT: vslidedown.vi v8, v9, 4, v0.t
14131413
; CHECK-NEXT: ret
14141414
%v0 = insertelement <8 x float> poison, float %e0, i64 0
@@ -1458,8 +1458,8 @@ define <8 x double> @buildvec_v8f64_zvl512(double %e0, double %e1, double %e2, d
14581458
; CHECK-NEXT: vfmv.v.f v8, fa4
14591459
; CHECK-NEXT: vfslide1down.vf v8, v8, fa5
14601460
; CHECK-NEXT: vfslide1down.vf v8, v8, fa6
1461-
; CHECK-NEXT: vmv.v.i v0, 15
14621461
; CHECK-NEXT: vfslide1down.vf v8, v8, fa7
1462+
; CHECK-NEXT: vmv.v.i v0, 15
14631463
; CHECK-NEXT: vslidedown.vi v8, v9, 4, v0.t
14641464
; CHECK-NEXT: ret
14651465
%v0 = insertelement <8 x double> poison, double %e0, i64 0

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-interleave.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ define <4 x double> @interleave_v2f64(<2 x double> %x, <2 x double> %y) {
5757
; RV32-V512-NEXT: vid.v v10
5858
; RV32-V512-NEXT: vsrl.vi v11, v10, 1
5959
; RV32-V512-NEXT: vsetvli zero, zero, e64, m1, ta, mu
60-
; RV32-V512-NEXT: vmv.v.i v0, 10
6160
; RV32-V512-NEXT: vrgatherei16.vv v10, v8, v11
61+
; RV32-V512-NEXT: vmv.v.i v0, 10
6262
; RV32-V512-NEXT: vrgatherei16.vv v10, v9, v11, v0.t
6363
; RV32-V512-NEXT: vmv.v.v v8, v10
6464
; RV32-V512-NEXT: ret
@@ -68,8 +68,8 @@ define <4 x double> @interleave_v2f64(<2 x double> %x, <2 x double> %y) {
6868
; RV64-V512-NEXT: vsetivli zero, 4, e64, m1, ta, mu
6969
; RV64-V512-NEXT: vid.v v10
7070
; RV64-V512-NEXT: vsrl.vi v11, v10, 1
71-
; RV64-V512-NEXT: vmv.v.i v0, 10
7271
; RV64-V512-NEXT: vrgather.vv v10, v8, v11
72+
; RV64-V512-NEXT: vmv.v.i v0, 10
7373
; RV64-V512-NEXT: vrgather.vv v10, v9, v11, v0.t
7474
; RV64-V512-NEXT: vmv.v.v v8, v10
7575
; RV64-V512-NEXT: ret

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i-sat.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ define void @fp2si_v8f64_v8i8(ptr %x, ptr %y) {
395395
; RV32-NEXT: fmin.d fa5, fa5, fa4
396396
; RV32-NEXT: fcvt.w.d a2, fa5, rtz
397397
; RV32-NEXT: and a0, a0, a2
398-
; RV32-NEXT: vmv.v.i v0, 15
399398
; RV32-NEXT: vslide1down.vx v9, v9, a0
399+
; RV32-NEXT: vmv.v.i v0, 15
400400
; RV32-NEXT: vslidedown.vi v9, v8, 4, v0.t
401401
; RV32-NEXT: vse8.v v9, (a1)
402402
; RV32-NEXT: addi sp, s0, -128
@@ -496,8 +496,8 @@ define void @fp2si_v8f64_v8i8(ptr %x, ptr %y) {
496496
; RV64-NEXT: fmin.d fa5, fa5, fa4
497497
; RV64-NEXT: fcvt.l.d a2, fa5, rtz
498498
; RV64-NEXT: and a0, a0, a2
499-
; RV64-NEXT: vmv.v.i v0, 15
500499
; RV64-NEXT: vslide1down.vx v9, v9, a0
500+
; RV64-NEXT: vmv.v.i v0, 15
501501
; RV64-NEXT: vslidedown.vi v9, v8, 4, v0.t
502502
; RV64-NEXT: vse8.v v9, (a1)
503503
; RV64-NEXT: addi sp, s0, -128
@@ -580,8 +580,8 @@ define void @fp2ui_v8f64_v8i8(ptr %x, ptr %y) {
580580
; RV32-NEXT: fmax.d fa4, fa4, fa3
581581
; RV32-NEXT: fmin.d fa5, fa4, fa5
582582
; RV32-NEXT: fcvt.wu.d a0, fa5, rtz
583-
; RV32-NEXT: vmv.v.i v0, 15
584583
; RV32-NEXT: vslide1down.vx v9, v9, a0
584+
; RV32-NEXT: vmv.v.i v0, 15
585585
; RV32-NEXT: vslidedown.vi v9, v8, 4, v0.t
586586
; RV32-NEXT: vse8.v v9, (a1)
587587
; RV32-NEXT: addi sp, s0, -128
@@ -656,8 +656,8 @@ define void @fp2ui_v8f64_v8i8(ptr %x, ptr %y) {
656656
; RV64-NEXT: fmax.d fa4, fa4, fa3
657657
; RV64-NEXT: fmin.d fa5, fa4, fa5
658658
; RV64-NEXT: fcvt.lu.d a0, fa5, rtz
659-
; RV64-NEXT: vmv.v.i v0, 15
660659
; RV64-NEXT: vslide1down.vx v9, v9, a0
660+
; RV64-NEXT: vmv.v.i v0, 15
661661
; RV64-NEXT: vslidedown.vi v9, v8, 4, v0.t
662662
; RV64-NEXT: vse8.v v9, (a1)
663663
; RV64-NEXT: addi sp, s0, -128

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-interleave.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ define <4 x i64> @interleave_v2i64(<2 x i64> %x, <2 x i64> %y) {
7070
; RV32-V512-NEXT: vid.v v10
7171
; RV32-V512-NEXT: vsrl.vi v11, v10, 1
7272
; RV32-V512-NEXT: vsetvli zero, zero, e64, m1, ta, mu
73-
; RV32-V512-NEXT: vmv.v.i v0, 10
7473
; RV32-V512-NEXT: vrgatherei16.vv v10, v8, v11
74+
; RV32-V512-NEXT: vmv.v.i v0, 10
7575
; RV32-V512-NEXT: vrgatherei16.vv v10, v9, v11, v0.t
7676
; RV32-V512-NEXT: vmv.v.v v8, v10
7777
; RV32-V512-NEXT: ret
@@ -81,8 +81,8 @@ define <4 x i64> @interleave_v2i64(<2 x i64> %x, <2 x i64> %y) {
8181
; RV64-V512-NEXT: vsetivli zero, 4, e64, m1, ta, mu
8282
; RV64-V512-NEXT: vid.v v10
8383
; RV64-V512-NEXT: vsrl.vi v11, v10, 1
84-
; RV64-V512-NEXT: vmv.v.i v0, 10
8584
; RV64-V512-NEXT: vrgather.vv v10, v8, v11
85+
; RV64-V512-NEXT: vmv.v.i v0, 10
8686
; RV64-V512-NEXT: vrgather.vv v10, v9, v11, v0.t
8787
; RV64-V512-NEXT: vmv.v.v v8, v10
8888
; RV64-V512-NEXT: ret
@@ -195,8 +195,8 @@ define <4 x i32> @interleave_v4i32_offset_1(<4 x i32> %x, <4 x i32> %y) {
195195
; V128-NEXT: vsetivli zero, 4, e32, m1, ta, mu
196196
; V128-NEXT: vid.v v8
197197
; V128-NEXT: vsrl.vi v8, v8, 1
198-
; V128-NEXT: vmv.v.i v0, 10
199198
; V128-NEXT: vadd.vi v8, v8, 1
199+
; V128-NEXT: vmv.v.i v0, 10
200200
; V128-NEXT: vrgather.vv v10, v9, v8, v0.t
201201
; V128-NEXT: vmv.v.v v8, v10
202202
; V128-NEXT: ret
@@ -210,8 +210,8 @@ define <4 x i32> @interleave_v4i32_offset_1(<4 x i32> %x, <4 x i32> %y) {
210210
; V512-NEXT: vsetivli zero, 4, e32, mf2, ta, mu
211211
; V512-NEXT: vid.v v8
212212
; V512-NEXT: vsrl.vi v8, v8, 1
213-
; V512-NEXT: vmv.v.i v0, 10
214213
; V512-NEXT: vadd.vi v8, v8, 1
214+
; V512-NEXT: vmv.v.i v0, 10
215215
; V512-NEXT: vrgather.vv v10, v9, v8, v0.t
216216
; V512-NEXT: vmv1r.v v8, v10
217217
; V512-NEXT: ret

0 commit comments

Comments
 (0)