diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h --- a/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -687,6 +687,9 @@ /// cost should return false, otherwise return true. bool isNumRegsMajorCostOfLSR() const; + /// Return true if LSR attempts to replace primary IV with other IV. + bool isAllowTerminatingConditionFoldingAfterLSR() const; + /// \returns true if LSR should not optimize a chain that includes \p I. bool isProfitableLSRChainElement(Instruction *I) const; @@ -1728,6 +1731,7 @@ virtual bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) = 0; virtual bool isNumRegsMajorCostOfLSR() = 0; + virtual bool isAllowTerminatingConditionFoldingAfterLSR() const = 0; virtual bool isProfitableLSRChainElement(Instruction *I) = 0; virtual bool canMacroFuseCmp() = 0; virtual bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, @@ -2158,6 +2162,9 @@ bool isNumRegsMajorCostOfLSR() override { return Impl.isNumRegsMajorCostOfLSR(); } + bool isAllowTerminatingConditionFoldingAfterLSR() const override { + return Impl.isAllowTerminatingConditionFoldingAfterLSR(); + } bool isProfitableLSRChainElement(Instruction *I) override { return Impl.isProfitableLSRChainElement(I); } diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -220,6 +220,8 @@ bool isNumRegsMajorCostOfLSR() const { return true; } + bool isAllowTerminatingConditionFoldingAfterLSR() const { return false; } + bool isProfitableLSRChainElement(Instruction *I) const { return false; } bool canMacroFuseCmp() const { return false; } diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -378,6 +378,11 @@ return TargetTransformInfoImplBase::isNumRegsMajorCostOfLSR(); } + bool isAllowTerminatingConditionFoldingAfterLSR() const { + return TargetTransformInfoImplBase:: + isAllowTerminatingConditionFoldingAfterLSR(); + } + bool isProfitableLSRChainElement(Instruction *I) { return TargetTransformInfoImplBase::isProfitableLSRChainElement(I); } diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -393,6 +393,10 @@ return TTIImpl->isNumRegsMajorCostOfLSR(); } +bool TargetTransformInfo::isAllowTerminatingConditionFoldingAfterLSR() const { + return TTIImpl->isAllowTerminatingConditionFoldingAfterLSR(); +} + bool TargetTransformInfo::isProfitableLSRChainElement(Instruction *I) const { return TTIImpl->isProfitableLSRChainElement(I); } diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h @@ -357,6 +357,8 @@ bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2); + + bool isAllowTerminatingConditionFoldingAfterLSR() const; }; } // end namespace llvm diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -1756,3 +1756,7 @@ C2.NumIVMuls, C2.NumBaseAdds, C2.ScaleCost, C2.ImmCost, C2.SetupCost); } + +bool RISCVTTIImpl::isAllowTerminatingConditionFoldingAfterLSR() const { + return true; +} diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -6908,7 +6908,8 @@ } } - if (AllowTerminatingConditionFoldingAfterLSR) { + if (AllowTerminatingConditionFoldingAfterLSR || + TTI.isAllowTerminatingConditionFoldingAfterLSR()) { if (auto Opt = canFoldTermCondOfLoop(L, SE, DT, LI)) { auto [ToFold, ToHelpFold, TermValueS, MustDrop] = *Opt; diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-asm.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-asm.ll --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-asm.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vector-strided-load-store-asm.ll @@ -13,7 +13,7 @@ define void @gather(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; CHECK-LABEL: gather: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: addi a2, a0, 1024 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: li a4, 5 ; CHECK-NEXT: .LBB0_1: # %vector.body @@ -23,10 +23,9 @@ ; CHECK-NEXT: vle8.v v9, (a0) ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vse8.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -32 ; CHECK-NEXT: addi a0, a0, 32 ; CHECK-NEXT: addi a1, a1, 160 -; CHECK-NEXT: bnez a2, .LBB0_1 +; CHECK-NEXT: bne a0, a2, .LBB0_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -54,7 +53,7 @@ define void @gather_masked(ptr noalias nocapture %A, ptr noalias nocapture readonly %B, <32 x i8> %maskedoff) { ; V-LABEL: gather_masked: ; V: # %bb.0: # %entry -; V-NEXT: li a2, 1024 +; V-NEXT: addi a2, a0, 1024 ; V-NEXT: lui a3, 983765 ; V-NEXT: addiw a3, a3, 873 ; V-NEXT: vsetivli zero, 1, e32, mf2, ta, ma @@ -69,16 +68,15 @@ ; V-NEXT: vle8.v v10, (a0) ; V-NEXT: vadd.vv v9, v10, v9 ; V-NEXT: vse8.v v9, (a0) -; V-NEXT: addi a2, a2, -32 ; V-NEXT: addi a0, a0, 32 ; V-NEXT: addi a1, a1, 160 -; V-NEXT: bnez a2, .LBB1_1 +; V-NEXT: bne a0, a2, .LBB1_1 ; V-NEXT: # %bb.2: # %for.cond.cleanup ; V-NEXT: ret ; ; ZVE32F-LABEL: gather_masked: ; ZVE32F: # %bb.0: # %entry -; ZVE32F-NEXT: li a2, 1024 +; ZVE32F-NEXT: addi a2, a0, 1024 ; ZVE32F-NEXT: lui a3, 983765 ; ZVE32F-NEXT: addiw a3, a3, 873 ; ZVE32F-NEXT: vsetivli zero, 1, e32, m1, ta, ma @@ -93,10 +91,9 @@ ; ZVE32F-NEXT: vle8.v v10, (a0) ; ZVE32F-NEXT: vadd.vv v9, v10, v9 ; ZVE32F-NEXT: vse8.v v9, (a0) -; ZVE32F-NEXT: addi a2, a2, -32 ; ZVE32F-NEXT: addi a0, a0, 32 ; ZVE32F-NEXT: addi a1, a1, 160 -; ZVE32F-NEXT: bnez a2, .LBB1_1 +; ZVE32F-NEXT: bne a0, a2, .LBB1_1 ; ZVE32F-NEXT: # %bb.2: # %for.cond.cleanup ; ZVE32F-NEXT: ret entry: @@ -125,7 +122,7 @@ ; CHECK-LABEL: gather_negative_stride: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: addi a1, a1, 155 -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: addi a2, a0, 1024 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: li a4, -5 ; CHECK-NEXT: .LBB2_1: # %vector.body @@ -135,10 +132,9 @@ ; CHECK-NEXT: vle8.v v9, (a0) ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vse8.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -32 ; CHECK-NEXT: addi a0, a0, 32 ; CHECK-NEXT: addi a1, a1, 160 -; CHECK-NEXT: bnez a2, .LBB2_1 +; CHECK-NEXT: bne a0, a2, .LBB2_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -166,7 +162,7 @@ define void @gather_zero_stride(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; CHECK-LABEL: gather_zero_stride: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: addi a2, a0, 1024 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB3_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -175,10 +171,9 @@ ; CHECK-NEXT: vle8.v v8, (a0) ; CHECK-NEXT: vadd.vx v8, v8, a4 ; CHECK-NEXT: vse8.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -32 ; CHECK-NEXT: addi a0, a0, 32 ; CHECK-NEXT: addi a1, a1, 160 -; CHECK-NEXT: bnez a2, .LBB3_1 +; CHECK-NEXT: bne a0, a2, .LBB3_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -206,7 +201,7 @@ define void @gather_zero_stride_unfold(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; V-LABEL: gather_zero_stride_unfold: ; V: # %bb.0: # %entry -; V-NEXT: li a2, 1024 +; V-NEXT: addi a2, a0, 1024 ; V-NEXT: li a3, 32 ; V-NEXT: .LBB4_1: # %vector.body ; V-NEXT: # =>This Inner Loop Header: Depth=1 @@ -215,16 +210,15 @@ ; V-NEXT: vle8.v v9, (a0) ; V-NEXT: vdivu.vv v8, v8, v9 ; V-NEXT: vse8.v v8, (a0) -; V-NEXT: addi a2, a2, -32 ; V-NEXT: addi a0, a0, 32 ; V-NEXT: addi a1, a1, 160 -; V-NEXT: bnez a2, .LBB4_1 +; V-NEXT: bne a0, a2, .LBB4_1 ; V-NEXT: # %bb.2: # %for.cond.cleanup ; V-NEXT: ret ; ; ZVE32F-LABEL: gather_zero_stride_unfold: ; ZVE32F: # %bb.0: # %entry -; ZVE32F-NEXT: li a2, 1024 +; ZVE32F-NEXT: addi a2, a0, 1024 ; ZVE32F-NEXT: li a3, 32 ; ZVE32F-NEXT: .LBB4_1: # %vector.body ; ZVE32F-NEXT: # =>This Inner Loop Header: Depth=1 @@ -233,16 +227,15 @@ ; ZVE32F-NEXT: vle8.v v9, (a0) ; ZVE32F-NEXT: vdivu.vv v8, v8, v9 ; ZVE32F-NEXT: vse8.v v8, (a0) -; ZVE32F-NEXT: addi a2, a2, -32 ; ZVE32F-NEXT: addi a0, a0, 32 ; ZVE32F-NEXT: addi a1, a1, 160 -; ZVE32F-NEXT: bnez a2, .LBB4_1 +; ZVE32F-NEXT: bne a0, a2, .LBB4_1 ; ZVE32F-NEXT: # %bb.2: # %for.cond.cleanup ; ZVE32F-NEXT: ret ; ; NOT-OPTIMIZED-LABEL: gather_zero_stride_unfold: ; NOT-OPTIMIZED: # %bb.0: # %entry -; NOT-OPTIMIZED-NEXT: li a2, 1024 +; NOT-OPTIMIZED-NEXT: addi a2, a0, 1024 ; NOT-OPTIMIZED-NEXT: li a3, 32 ; NOT-OPTIMIZED-NEXT: .LBB4_1: # %vector.body ; NOT-OPTIMIZED-NEXT: # =>This Inner Loop Header: Depth=1 @@ -252,10 +245,9 @@ ; NOT-OPTIMIZED-NEXT: vmv.v.x v9, a4 ; NOT-OPTIMIZED-NEXT: vdivu.vv v8, v9, v8 ; NOT-OPTIMIZED-NEXT: vse8.v v8, (a0) -; NOT-OPTIMIZED-NEXT: addi a2, a2, -32 ; NOT-OPTIMIZED-NEXT: addi a0, a0, 32 ; NOT-OPTIMIZED-NEXT: addi a1, a1, 160 -; NOT-OPTIMIZED-NEXT: bnez a2, .LBB4_1 +; NOT-OPTIMIZED-NEXT: bne a0, a2, .LBB4_1 ; NOT-OPTIMIZED-NEXT: # %bb.2: # %for.cond.cleanup ; NOT-OPTIMIZED-NEXT: ret entry: @@ -287,7 +279,7 @@ define void @scatter(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; CHECK-LABEL: scatter: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: addi a2, a1, 1024 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: li a4, 5 ; CHECK-NEXT: .LBB5_1: # %vector.body @@ -297,10 +289,9 @@ ; CHECK-NEXT: vlse8.v v9, (a0), a4 ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vsse8.v v8, (a0), a4 -; CHECK-NEXT: addi a2, a2, -32 ; CHECK-NEXT: addi a1, a1, 32 ; CHECK-NEXT: addi a0, a0, 160 -; CHECK-NEXT: bnez a2, .LBB5_1 +; CHECK-NEXT: bne a1, a2, .LBB5_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -328,7 +319,7 @@ define void @scatter_masked(ptr noalias nocapture %A, ptr noalias nocapture readonly %B, <32 x i8> %maskedoff) { ; V-LABEL: scatter_masked: ; V: # %bb.0: # %entry -; V-NEXT: li a2, 1024 +; V-NEXT: addi a2, a1, 1024 ; V-NEXT: li a3, 32 ; V-NEXT: lui a4, 983765 ; V-NEXT: addiw a4, a4, 873 @@ -343,16 +334,15 @@ ; V-NEXT: vlse8.v v10, (a0), a4, v0.t ; V-NEXT: vadd.vv v9, v10, v9 ; V-NEXT: vsse8.v v9, (a0), a4, v0.t -; V-NEXT: addi a2, a2, -32 ; V-NEXT: addi a1, a1, 32 ; V-NEXT: addi a0, a0, 160 -; V-NEXT: bnez a2, .LBB6_1 +; V-NEXT: bne a1, a2, .LBB6_1 ; V-NEXT: # %bb.2: # %for.cond.cleanup ; V-NEXT: ret ; ; ZVE32F-LABEL: scatter_masked: ; ZVE32F: # %bb.0: # %entry -; ZVE32F-NEXT: li a2, 1024 +; ZVE32F-NEXT: addi a2, a1, 1024 ; ZVE32F-NEXT: li a3, 32 ; ZVE32F-NEXT: lui a4, 983765 ; ZVE32F-NEXT: addiw a4, a4, 873 @@ -367,10 +357,9 @@ ; ZVE32F-NEXT: vlse8.v v10, (a0), a4, v0.t ; ZVE32F-NEXT: vadd.vv v9, v10, v9 ; ZVE32F-NEXT: vsse8.v v9, (a0), a4, v0.t -; ZVE32F-NEXT: addi a2, a2, -32 ; ZVE32F-NEXT: addi a1, a1, 32 ; ZVE32F-NEXT: addi a0, a0, 160 -; ZVE32F-NEXT: bnez a2, .LBB6_1 +; ZVE32F-NEXT: bne a1, a2, .LBB6_1 ; ZVE32F-NEXT: # %bb.2: # %for.cond.cleanup ; ZVE32F-NEXT: ret entry: @@ -402,7 +391,8 @@ define void @gather_pow2(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; CHECK-LABEL: gather_pow2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 16 ; CHECK-NEXT: li a4, 32 ; CHECK-NEXT: .LBB7_1: # %vector.body @@ -415,10 +405,9 @@ ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vsetvli zero, a4, e8, m1, ta, ma ; CHECK-NEXT: vse8.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -8 ; CHECK-NEXT: addi a0, a0, 32 ; CHECK-NEXT: addi a1, a1, 128 -; CHECK-NEXT: bnez a2, .LBB7_1 +; CHECK-NEXT: bne a0, a2, .LBB7_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -450,7 +439,8 @@ define void @scatter_pow2(ptr noalias nocapture %A, ptr noalias nocapture readonly %B) { ; CHECK-LABEL: scatter_pow2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a1, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: li a4, 16 ; CHECK-NEXT: .LBB8_1: # %vector.body @@ -461,10 +451,9 @@ ; CHECK-NEXT: vlse32.v v9, (a0), a4 ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vsse32.v v8, (a0), a4 -; CHECK-NEXT: addi a2, a2, -8 ; CHECK-NEXT: addi a1, a1, 32 ; CHECK-NEXT: addi a0, a0, 128 -; CHECK-NEXT: bnez a2, .LBB8_1 +; CHECK-NEXT: bne a1, a2, .LBB8_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -501,7 +490,8 @@ ; CHECK-LABEL: struct_gather: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: addi a1, a1, 132 -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 16 ; CHECK-NEXT: vsetivli zero, 8, e32, m1, ta, ma ; CHECK-NEXT: .LBB9_1: # %vector.body @@ -516,10 +506,9 @@ ; CHECK-NEXT: vadd.vv v9, v11, v9 ; CHECK-NEXT: vse32.v v8, (a0) ; CHECK-NEXT: vse32.v v9, (a4) -; CHECK-NEXT: addi a2, a2, -16 ; CHECK-NEXT: addi a0, a0, 64 ; CHECK-NEXT: addi a1, a1, 256 -; CHECK-NEXT: bnez a2, .LBB9_1 +; CHECK-NEXT: bne a0, a2, .LBB9_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -650,7 +639,8 @@ define void @gather_of_pointers(ptr noalias nocapture %arg, ptr noalias nocapture readonly %arg1) { ; V-LABEL: gather_of_pointers: ; V: # %bb.0: # %bb -; V-NEXT: li a2, 1024 +; V-NEXT: lui a2, 2 +; V-NEXT: add a2, a0, a2 ; V-NEXT: li a3, 40 ; V-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; V-NEXT: .LBB11_1: # %bb2 @@ -661,22 +651,22 @@ ; V-NEXT: addi a4, a0, 16 ; V-NEXT: vse64.v v8, (a0) ; V-NEXT: vse64.v v9, (a4) -; V-NEXT: addi a2, a2, -4 ; V-NEXT: addi a0, a0, 32 ; V-NEXT: addi a1, a1, 160 -; V-NEXT: bnez a2, .LBB11_1 +; V-NEXT: bne a0, a2, .LBB11_1 ; V-NEXT: # %bb.2: # %bb18 ; V-NEXT: ret ; ; ZVE32F-LABEL: gather_of_pointers: ; ZVE32F: # %bb.0: # %bb ; ZVE32F-NEXT: li a2, 0 -; ZVE32F-NEXT: li a3, 1 -; ZVE32F-NEXT: li a4, 1024 +; ZVE32F-NEXT: lui a3, 2 +; ZVE32F-NEXT: add a3, a0, a3 +; ZVE32F-NEXT: li a4, 1 ; ZVE32F-NEXT: li a5, 40 ; ZVE32F-NEXT: .LBB11_1: # %bb2 ; ZVE32F-NEXT: # =>This Inner Loop Header: Depth=1 -; ZVE32F-NEXT: mul a6, a3, a5 +; ZVE32F-NEXT: mul a6, a4, a5 ; ZVE32F-NEXT: add a6, a1, a6 ; ZVE32F-NEXT: mul a7, a2, a5 ; ZVE32F-NEXT: add a7, a1, a7 @@ -689,10 +679,9 @@ ; ZVE32F-NEXT: sd a6, 24(a0) ; ZVE32F-NEXT: sd a7, 16(a0) ; ZVE32F-NEXT: addi a2, a2, 4 -; ZVE32F-NEXT: addi a3, a3, 4 -; ZVE32F-NEXT: addi a4, a4, -4 ; ZVE32F-NEXT: addi a0, a0, 32 -; ZVE32F-NEXT: bnez a4, .LBB11_1 +; ZVE32F-NEXT: addi a4, a4, 4 +; ZVE32F-NEXT: bne a0, a3, .LBB11_1 ; ZVE32F-NEXT: # %bb.2: # %bb18 ; ZVE32F-NEXT: ret bb: @@ -727,7 +716,8 @@ define void @scatter_of_pointers(ptr noalias nocapture %arg, ptr noalias nocapture readonly %arg1) { ; V-LABEL: scatter_of_pointers: ; V: # %bb.0: # %bb -; V-NEXT: li a2, 1024 +; V-NEXT: lui a2, 2 +; V-NEXT: add a2, a1, a2 ; V-NEXT: li a3, 40 ; V-NEXT: vsetivli zero, 2, e64, m1, ta, ma ; V-NEXT: .LBB12_1: # %bb2 @@ -738,18 +728,18 @@ ; V-NEXT: addi a4, a0, 80 ; V-NEXT: vsse64.v v8, (a0), a3 ; V-NEXT: vsse64.v v9, (a4), a3 -; V-NEXT: addi a2, a2, -4 ; V-NEXT: addi a1, a1, 32 ; V-NEXT: addi a0, a0, 160 -; V-NEXT: bnez a2, .LBB12_1 +; V-NEXT: bne a1, a2, .LBB12_1 ; V-NEXT: # %bb.2: # %bb18 ; V-NEXT: ret ; ; ZVE32F-LABEL: scatter_of_pointers: ; ZVE32F: # %bb.0: # %bb ; ZVE32F-NEXT: li a2, 0 -; ZVE32F-NEXT: li a3, 1 -; ZVE32F-NEXT: li a4, 1024 +; ZVE32F-NEXT: lui a3, 2 +; ZVE32F-NEXT: add a3, a1, a3 +; ZVE32F-NEXT: li a4, 1 ; ZVE32F-NEXT: li a5, 40 ; ZVE32F-NEXT: .LBB12_1: # %bb2 ; ZVE32F-NEXT: # =>This Inner Loop Header: Depth=1 @@ -757,7 +747,7 @@ ; ZVE32F-NEXT: ld a7, 0(a1) ; ZVE32F-NEXT: ld t0, 24(a1) ; ZVE32F-NEXT: ld t1, 16(a1) -; ZVE32F-NEXT: mul t2, a3, a5 +; ZVE32F-NEXT: mul t2, a4, a5 ; ZVE32F-NEXT: add t2, a0, t2 ; ZVE32F-NEXT: mul t3, a2, a5 ; ZVE32F-NEXT: add t3, a0, t3 @@ -766,10 +756,9 @@ ; ZVE32F-NEXT: sd t1, 80(t3) ; ZVE32F-NEXT: sd t0, 80(t2) ; ZVE32F-NEXT: addi a2, a2, 4 -; ZVE32F-NEXT: addi a3, a3, 4 -; ZVE32F-NEXT: addi a4, a4, -4 ; ZVE32F-NEXT: addi a1, a1, 32 -; ZVE32F-NEXT: bnez a4, .LBB12_1 +; ZVE32F-NEXT: addi a4, a4, 4 +; ZVE32F-NEXT: bne a1, a3, .LBB12_1 ; ZVE32F-NEXT: # %bb.2: # %bb18 ; ZVE32F-NEXT: ret bb: @@ -806,53 +795,56 @@ ; CHECK-NEXT: li a3, 1024 ; CHECK-NEXT: beq a2, a3, .LBB13_7 ; CHECK-NEXT: # %bb.1: # %bb3 -; CHECK-NEXT: li a4, 1023 -; CHECK-NEXT: subw a4, a4, a2 -; CHECK-NEXT: li a5, 31 -; CHECK-NEXT: mv a3, a2 -; CHECK-NEXT: bltu a4, a5, .LBB13_5 +; CHECK-NEXT: li a3, 1023 +; CHECK-NEXT: subw a5, a3, a2 +; CHECK-NEXT: li a6, 31 +; CHECK-NEXT: mv a4, a2 +; CHECK-NEXT: bltu a5, a6, .LBB13_5 ; CHECK-NEXT: # %bb.2: # %bb9 -; CHECK-NEXT: slli a4, a4, 32 -; CHECK-NEXT: srli a4, a4, 32 -; CHECK-NEXT: addi a4, a4, 1 -; CHECK-NEXT: andi a5, a4, -32 -; CHECK-NEXT: add a3, a5, a2 -; CHECK-NEXT: slli a7, a2, 2 -; CHECK-NEXT: add a6, a0, a2 +; CHECK-NEXT: slli a5, a5, 32 +; CHECK-NEXT: srli a5, a5, 32 +; CHECK-NEXT: addi a5, a5, 1 +; CHECK-NEXT: andi a6, a5, -32 +; CHECK-NEXT: add a4, a6, a2 +; CHECK-NEXT: slli t0, a2, 2 +; CHECK-NEXT: add a7, a0, a2 ; CHECK-NEXT: add a2, a1, a2 -; CHECK-NEXT: add a2, a2, a7 -; CHECK-NEXT: li a7, 32 -; CHECK-NEXT: li t0, 5 -; CHECK-NEXT: mv t1, a5 +; CHECK-NEXT: add a2, a2, t0 +; CHECK-NEXT: add t0, a4, a0 +; CHECK-NEXT: li t1, 32 +; CHECK-NEXT: li t2, 5 ; CHECK-NEXT: .LBB13_3: # %bb15 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: vsetvli zero, a7, e8, m1, ta, ma -; CHECK-NEXT: vlse8.v v8, (a2), t0 -; CHECK-NEXT: vle8.v v9, (a6) +; CHECK-NEXT: vsetvli zero, t1, e8, m1, ta, ma +; CHECK-NEXT: vlse8.v v8, (a2), t2 +; CHECK-NEXT: vle8.v v9, (a7) ; CHECK-NEXT: vadd.vv v8, v9, v8 -; CHECK-NEXT: vse8.v v8, (a6) -; CHECK-NEXT: addi t1, t1, -32 -; CHECK-NEXT: addi a6, a6, 32 +; CHECK-NEXT: vse8.v v8, (a7) +; CHECK-NEXT: addi a7, a7, 32 ; CHECK-NEXT: addi a2, a2, 160 -; CHECK-NEXT: bnez t1, .LBB13_3 +; CHECK-NEXT: bne a7, t0, .LBB13_3 ; CHECK-NEXT: # %bb.4: # %bb30 -; CHECK-NEXT: beq a4, a5, .LBB13_7 +; CHECK-NEXT: beq a5, a6, .LBB13_7 ; CHECK-NEXT: .LBB13_5: # %bb32 -; CHECK-NEXT: addiw a2, a3, -1024 -; CHECK-NEXT: add a0, a0, a3 -; CHECK-NEXT: slli a4, a3, 2 -; CHECK-NEXT: add a1, a1, a3 +; CHECK-NEXT: add a2, a0, a4 +; CHECK-NEXT: slli a5, a4, 2 ; CHECK-NEXT: add a1, a1, a4 +; CHECK-NEXT: add a1, a1, a5 +; CHECK-NEXT: subw a3, a3, a4 +; CHECK-NEXT: slli a3, a3, 32 +; CHECK-NEXT: srli a3, a3, 32 +; CHECK-NEXT: add a0, a4, a0 +; CHECK-NEXT: add a0, a0, a3 +; CHECK-NEXT: addi a0, a0, 1 ; CHECK-NEXT: .LBB13_6: # %bb35 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: lbu a3, 0(a1) -; CHECK-NEXT: lbu a4, 0(a0) +; CHECK-NEXT: lbu a4, 0(a2) ; CHECK-NEXT: add a3, a4, a3 -; CHECK-NEXT: sb a3, 0(a0) -; CHECK-NEXT: addiw a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 1 +; CHECK-NEXT: sb a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 1 ; CHECK-NEXT: addi a1, a1, 5 -; CHECK-NEXT: bnez a2, .LBB13_6 +; CHECK-NEXT: bne a2, a0, .LBB13_6 ; CHECK-NEXT: .LBB13_7: # %bb34 ; CHECK-NEXT: ret bb: @@ -926,6 +918,10 @@ ; CHECK-NEXT: slli a2, a2, 4 ; CHECK-NEXT: beqz a2, .LBB14_3 ; CHECK-NEXT: # %bb.1: # %bb2 +; CHECK-NEXT: addi a2, a2, -16 +; CHECK-NEXT: andi a2, a2, -16 +; CHECK-NEXT: add a2, a2, a0 +; CHECK-NEXT: addi a2, a2, 16 ; CHECK-NEXT: li a3, 5 ; CHECK-NEXT: vsetivli zero, 16, e8, mf2, ta, ma ; CHECK-NEXT: .LBB14_2: # %bb4 @@ -934,10 +930,9 @@ ; CHECK-NEXT: vle8.v v9, (a0) ; CHECK-NEXT: vadd.vv v8, v9, v8 ; CHECK-NEXT: vse8.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -16 ; CHECK-NEXT: addi a0, a0, 16 ; CHECK-NEXT: addi a1, a1, 80 -; CHECK-NEXT: bnez a2, .LBB14_2 +; CHECK-NEXT: bne a0, a2, .LBB14_2 ; CHECK-NEXT: .LBB14_3: # %bb16 ; CHECK-NEXT: ret bb: diff --git a/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll b/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll --- a/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll +++ b/llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll @@ -5,16 +5,16 @@ define void @sink_splat_mul(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_mul: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB0_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vmul.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB0_1 +; CHECK-NEXT: bne a0, a2, .LBB0_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -39,16 +39,16 @@ define void @sink_splat_add(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_add: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB1_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vadd.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB1_1 +; CHECK-NEXT: bne a0, a2, .LBB1_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -73,16 +73,16 @@ define void @sink_splat_sub(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_sub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB2_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB2_1 +; CHECK-NEXT: bne a0, a2, .LBB2_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -107,16 +107,16 @@ define void @sink_splat_rsub(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_rsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB3_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vrsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB3_1 +; CHECK-NEXT: bne a0, a2, .LBB3_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -141,16 +141,16 @@ define void @sink_splat_and(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_and: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB4_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vand.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB4_1 +; CHECK-NEXT: bne a0, a2, .LBB4_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -175,16 +175,16 @@ define void @sink_splat_or(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_or: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB5_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB5_1 +; CHECK-NEXT: bne a0, a2, .LBB5_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -209,16 +209,16 @@ define void @sink_splat_xor(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_xor: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB6_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vxor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB6_1 +; CHECK-NEXT: bne a0, a2, .LBB6_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -269,17 +269,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB7_7 ; CHECK-NEXT: .LBB7_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB7_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: mul a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB7_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: mul a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB7_6 ; CHECK-NEXT: .LBB7_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -360,17 +360,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB8_7 ; CHECK-NEXT: .LBB8_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB8_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: add a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB8_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: add a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB8_6 ; CHECK-NEXT: .LBB8_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -451,17 +451,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB9_7 ; CHECK-NEXT: .LBB9_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB9_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: add a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB9_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: add a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB9_6 ; CHECK-NEXT: .LBB9_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -542,17 +542,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB10_7 ; CHECK-NEXT: .LBB10_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB10_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: subw a2, a1, a2 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB10_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: subw a3, a1, a3 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB10_6 ; CHECK-NEXT: .LBB10_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -633,17 +633,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB11_7 ; CHECK-NEXT: .LBB11_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB11_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: and a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB11_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: and a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB11_6 ; CHECK-NEXT: .LBB11_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -724,17 +724,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB12_7 ; CHECK-NEXT: .LBB12_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB12_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: or a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB12_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: or a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB12_6 ; CHECK-NEXT: .LBB12_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -815,17 +815,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB13_7 ; CHECK-NEXT: .LBB13_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB13_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: xor a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB13_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: xor a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB13_6 ; CHECK-NEXT: .LBB13_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -880,16 +880,16 @@ define void @sink_splat_shl(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_shl: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB14_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsll.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB14_1 +; CHECK-NEXT: bne a0, a2, .LBB14_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -914,16 +914,16 @@ define void @sink_splat_lshr(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_lshr: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB15_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsrl.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB15_1 +; CHECK-NEXT: bne a0, a2, .LBB15_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -948,16 +948,16 @@ define void @sink_splat_ashr(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_ashr: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB16_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsra.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB16_1 +; CHECK-NEXT: bne a0, a2, .LBB16_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1008,17 +1008,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB17_7 ; CHECK-NEXT: .LBB17_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB17_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: sllw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB17_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: sllw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB17_6 ; CHECK-NEXT: .LBB17_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1099,17 +1099,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB18_7 ; CHECK-NEXT: .LBB18_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB18_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: srlw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB18_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: srlw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB18_6 ; CHECK-NEXT: .LBB18_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1190,17 +1190,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a3, .LBB19_7 ; CHECK-NEXT: .LBB19_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB19_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a1, 0(a0) -; CHECK-NEXT: srli a1, a1, 2 -; CHECK-NEXT: sw a1, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB19_6 +; CHECK-NEXT: lw a2, 0(a1) +; CHECK-NEXT: srli a2, a2, 2 +; CHECK-NEXT: sw a2, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB19_6 ; CHECK-NEXT: .LBB19_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1255,16 +1255,16 @@ define void @sink_splat_fmul(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_fmul: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB20_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfmul.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB20_1 +; CHECK-NEXT: bne a0, a1, .LBB20_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1289,16 +1289,16 @@ define void @sink_splat_fdiv(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_fdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB21_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfdiv.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB21_1 +; CHECK-NEXT: bne a0, a1, .LBB21_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1323,16 +1323,16 @@ define void @sink_splat_frdiv(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_frdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB22_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfrdiv.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB22_1 +; CHECK-NEXT: bne a0, a1, .LBB22_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1357,16 +1357,16 @@ define void @sink_splat_fadd(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_fadd: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB23_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfadd.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB23_1 +; CHECK-NEXT: bne a0, a1, .LBB23_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1391,16 +1391,16 @@ define void @sink_splat_fsub(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_fsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB24_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfsub.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB24_1 +; CHECK-NEXT: bne a0, a1, .LBB24_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1425,16 +1425,16 @@ define void @sink_splat_frsub(ptr nocapture %a, float %x) { ; CHECK-LABEL: sink_splat_frsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB25_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vfrsub.vf v8, v8, fa0 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB25_1 +; CHECK-NEXT: bne a0, a1, .LBB25_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1484,17 +1484,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB26_7 ; CHECK-NEXT: .LBB26_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB26_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fmul.s fa5, fa5, fa0 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB26_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB26_6 ; CHECK-NEXT: .LBB26_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1574,17 +1574,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB27_7 ; CHECK-NEXT: .LBB27_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB27_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fdiv.s fa5, fa5, fa0 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB27_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB27_6 ; CHECK-NEXT: .LBB27_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1664,17 +1664,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB28_7 ; CHECK-NEXT: .LBB28_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB28_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fdiv.s fa5, fa0, fa5 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB28_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB28_6 ; CHECK-NEXT: .LBB28_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1754,17 +1754,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB29_7 ; CHECK-NEXT: .LBB29_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB29_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fadd.s fa5, fa5, fa0 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB29_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB29_6 ; CHECK-NEXT: .LBB29_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1844,17 +1844,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB30_7 ; CHECK-NEXT: .LBB30_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB30_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fsub.s fa5, fa5, fa0 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB30_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB30_6 ; CHECK-NEXT: .LBB30_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1934,17 +1934,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB31_7 ; CHECK-NEXT: .LBB31_5: # %for.body.preheader -; CHECK-NEXT: addi a2, a1, -1024 ; CHECK-NEXT: slli a1, a1, 2 -; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: add a1, a0, a1 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a0, a0, a2 ; CHECK-NEXT: .LBB31_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: flw fa5, 0(a0) +; CHECK-NEXT: flw fa5, 0(a1) ; CHECK-NEXT: fsub.s fa5, fa0, fa5 -; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a2, a2, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a2, .LBB31_6 +; CHECK-NEXT: fsw fa5, 0(a1) +; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: bne a1, a0, .LBB31_6 ; CHECK-NEXT: .LBB31_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -1999,7 +1999,8 @@ define void @sink_splat_fma(ptr noalias nocapture %a, ptr nocapture readonly %b, float %x) { ; CHECK-LABEL: sink_splat_fma: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a1, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB32_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2007,10 +2008,9 @@ ; CHECK-NEXT: vle32.v v9, (a1) ; CHECK-NEXT: vfmacc.vf v9, fa0, v8 ; CHECK-NEXT: vse32.v v9, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a1, a1, 16 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB32_1 +; CHECK-NEXT: bne a1, a2, .LBB32_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2037,7 +2037,8 @@ define void @sink_splat_fma_commute(ptr noalias nocapture %a, ptr nocapture readonly %b, float %x) { ; CHECK-LABEL: sink_splat_fma_commute: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a1, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB33_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2045,10 +2046,9 @@ ; CHECK-NEXT: vle32.v v9, (a1) ; CHECK-NEXT: vfmacc.vf v9, fa0, v8 ; CHECK-NEXT: vse32.v v9, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a1, a1, 16 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB33_1 +; CHECK-NEXT: bne a1, a2, .LBB33_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2103,20 +2103,20 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a5, .LBB34_7 ; CHECK-NEXT: .LBB34_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 -; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a1, a1, a2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: slli a3, a2, 2 +; CHECK-NEXT: add a2, a1, a3 +; CHECK-NEXT: add a0, a0, a3 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a1, a1, a3 ; CHECK-NEXT: .LBB34_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: flw fa5, 0(a0) -; CHECK-NEXT: flw fa4, 0(a1) +; CHECK-NEXT: flw fa4, 0(a2) ; CHECK-NEXT: fmadd.s fa5, fa5, fa0, fa4 ; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: addi a2, a2, 4 ; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB34_6 +; CHECK-NEXT: bne a2, a1, .LBB34_6 ; CHECK-NEXT: .LBB34_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2203,20 +2203,20 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a5, .LBB35_7 ; CHECK-NEXT: .LBB35_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 -; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a1, a1, a2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: slli a3, a2, 2 +; CHECK-NEXT: add a2, a1, a3 +; CHECK-NEXT: add a0, a0, a3 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a1, a1, a3 ; CHECK-NEXT: .LBB35_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: flw fa5, 0(a0) -; CHECK-NEXT: flw fa4, 0(a1) +; CHECK-NEXT: flw fa4, 0(a2) ; CHECK-NEXT: fmadd.s fa5, fa0, fa5, fa4 ; CHECK-NEXT: fsw fa5, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a1, a1, 4 +; CHECK-NEXT: addi a2, a2, 4 ; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB35_6 +; CHECK-NEXT: bne a2, a1, .LBB35_6 ; CHECK-NEXT: .LBB35_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2280,7 +2280,8 @@ define void @sink_splat_icmp(ptr nocapture %x, i32 signext %y) { ; CHECK-LABEL: sink_splat_icmp: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vmv.v.i v8, 0 ; CHECK-NEXT: .LBB36_1: # %vector.body @@ -2288,9 +2289,8 @@ ; CHECK-NEXT: vle32.v v9, (a0) ; CHECK-NEXT: vmseq.vx v0, v9, a1 ; CHECK-NEXT: vse32.v v8, (a0), v0.t -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB36_1 +; CHECK-NEXT: bne a0, a2, .LBB36_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2316,7 +2316,8 @@ define void @sink_splat_fcmp(ptr nocapture %x, float %y) { ; CHECK-LABEL: sink_splat_fcmp: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vmv.v.i v8, 0 ; CHECK-NEXT: .LBB37_1: # %vector.body @@ -2324,9 +2325,8 @@ ; CHECK-NEXT: vle32.v v9, (a0) ; CHECK-NEXT: vmfeq.vf v0, v9, fa0 ; CHECK-NEXT: vse32.v v8, (a0), v0.t -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB37_1 +; CHECK-NEXT: bne a0, a1, .LBB37_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2352,16 +2352,16 @@ define void @sink_splat_udiv(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_udiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB38_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vdivu.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB38_1 +; CHECK-NEXT: bne a0, a2, .LBB38_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2386,16 +2386,16 @@ define void @sink_splat_sdiv(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_sdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB39_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vdiv.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB39_1 +; CHECK-NEXT: bne a0, a2, .LBB39_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2420,16 +2420,16 @@ define void @sink_splat_urem(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_urem: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB40_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vremu.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB40_1 +; CHECK-NEXT: bne a0, a2, .LBB40_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2454,16 +2454,16 @@ define void @sink_splat_srem(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_srem: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB41_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vrem.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB41_1 +; CHECK-NEXT: bne a0, a2, .LBB41_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2514,17 +2514,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB42_7 ; CHECK-NEXT: .LBB42_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB42_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: divuw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB42_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: divuw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB42_6 ; CHECK-NEXT: .LBB42_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2605,17 +2605,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB43_7 ; CHECK-NEXT: .LBB43_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB43_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: divw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB43_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: divw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB43_6 ; CHECK-NEXT: .LBB43_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2696,17 +2696,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB44_7 ; CHECK-NEXT: .LBB44_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB44_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: remuw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB44_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: remuw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB44_6 ; CHECK-NEXT: .LBB44_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2787,17 +2787,17 @@ ; CHECK-NEXT: # %bb.4: # %middle.block ; CHECK-NEXT: beqz a4, .LBB45_7 ; CHECK-NEXT: .LBB45_5: # %for.body.preheader -; CHECK-NEXT: addi a3, a2, -1024 ; CHECK-NEXT: slli a2, a2, 2 -; CHECK-NEXT: add a0, a0, a2 +; CHECK-NEXT: add a2, a0, a2 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a0, a0, a3 ; CHECK-NEXT: .LBB45_6: # %for.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 -; CHECK-NEXT: lw a2, 0(a0) -; CHECK-NEXT: remw a2, a2, a1 -; CHECK-NEXT: sw a2, 0(a0) -; CHECK-NEXT: addi a3, a3, 1 -; CHECK-NEXT: addi a0, a0, 4 -; CHECK-NEXT: bnez a3, .LBB45_6 +; CHECK-NEXT: lw a3, 0(a2) +; CHECK-NEXT: remw a3, a3, a1 +; CHECK-NEXT: sw a3, 0(a2) +; CHECK-NEXT: addi a2, a2, 4 +; CHECK-NEXT: bne a2, a0, .LBB45_6 ; CHECK-NEXT: .LBB45_7: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2854,7 +2854,8 @@ define void @sink_splat_vp_mul(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_mul: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB46_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2863,9 +2864,8 @@ ; CHECK-NEXT: vmul.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB46_1 +; CHECK-NEXT: bne a0, a3, .LBB46_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2892,7 +2892,8 @@ define void @sink_splat_vp_add(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_add: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB47_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2901,9 +2902,8 @@ ; CHECK-NEXT: vadd.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB47_1 +; CHECK-NEXT: bne a0, a3, .LBB47_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2928,7 +2928,8 @@ define void @sink_splat_vp_add_commute(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_add_commute: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB48_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2937,9 +2938,8 @@ ; CHECK-NEXT: vadd.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB48_1 +; CHECK-NEXT: bne a0, a3, .LBB48_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -2966,7 +2966,8 @@ define void @sink_splat_vp_sub(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_sub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB49_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -2975,9 +2976,8 @@ ; CHECK-NEXT: vsub.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB49_1 +; CHECK-NEXT: bne a0, a3, .LBB49_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3002,7 +3002,8 @@ define void @sink_splat_vp_rsub(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_rsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB50_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3011,9 +3012,8 @@ ; CHECK-NEXT: vrsub.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB50_1 +; CHECK-NEXT: bne a0, a3, .LBB50_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3040,7 +3040,8 @@ define void @sink_splat_vp_shl(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_shl: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB51_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3049,9 +3050,8 @@ ; CHECK-NEXT: vsll.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB51_1 +; CHECK-NEXT: bne a0, a3, .LBB51_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3078,7 +3078,8 @@ define void @sink_splat_vp_lshr(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_lshr: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB52_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3087,9 +3088,8 @@ ; CHECK-NEXT: vsrl.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB52_1 +; CHECK-NEXT: bne a0, a3, .LBB52_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3116,7 +3116,8 @@ define void @sink_splat_vp_ashr(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_ashr: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB53_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3125,9 +3126,8 @@ ; CHECK-NEXT: vsra.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB53_1 +; CHECK-NEXT: bne a0, a3, .LBB53_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3154,7 +3154,8 @@ define void @sink_splat_vp_fmul(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fmul: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB54_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3163,9 +3164,8 @@ ; CHECK-NEXT: vfmul.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB54_1 +; CHECK-NEXT: bne a0, a2, .LBB54_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3192,7 +3192,8 @@ define void @sink_splat_vp_fdiv(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB55_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3201,9 +3202,8 @@ ; CHECK-NEXT: vfdiv.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB55_1 +; CHECK-NEXT: bne a0, a2, .LBB55_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3228,7 +3228,8 @@ define void @sink_splat_vp_frdiv(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_frdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB56_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3237,9 +3238,8 @@ ; CHECK-NEXT: vfrdiv.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB56_1 +; CHECK-NEXT: bne a0, a2, .LBB56_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3266,7 +3266,8 @@ define void @sink_splat_vp_fadd(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fadd: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB57_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3275,9 +3276,8 @@ ; CHECK-NEXT: vfadd.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB57_1 +; CHECK-NEXT: bne a0, a2, .LBB57_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3304,7 +3304,8 @@ define void @sink_splat_vp_fsub(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB58_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3313,9 +3314,8 @@ ; CHECK-NEXT: vfsub.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB58_1 +; CHECK-NEXT: bne a0, a2, .LBB58_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3342,7 +3342,8 @@ define void @sink_splat_vp_frsub(ptr nocapture %a, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_frsub: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB59_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3351,9 +3352,8 @@ ; CHECK-NEXT: vfrsub.vf v8, v8, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB59_1 +; CHECK-NEXT: bne a0, a2, .LBB59_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3380,7 +3380,8 @@ define void @sink_splat_vp_udiv(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_udiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB60_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3389,9 +3390,8 @@ ; CHECK-NEXT: vdivu.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB60_1 +; CHECK-NEXT: bne a0, a3, .LBB60_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3418,7 +3418,8 @@ define void @sink_splat_vp_sdiv(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_sdiv: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB61_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3427,9 +3428,8 @@ ; CHECK-NEXT: vdiv.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB61_1 +; CHECK-NEXT: bne a0, a3, .LBB61_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3456,7 +3456,8 @@ define void @sink_splat_vp_urem(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_urem: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB62_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3465,9 +3466,8 @@ ; CHECK-NEXT: vremu.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB62_1 +; CHECK-NEXT: bne a0, a3, .LBB62_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3494,7 +3494,8 @@ define void @sink_splat_vp_srem(ptr nocapture %a, i32 signext %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_srem: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB63_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3503,9 +3504,8 @@ ; CHECK-NEXT: vrem.vx v8, v8, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB63_1 +; CHECK-NEXT: bne a0, a3, .LBB63_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3534,7 +3534,8 @@ ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vmv.v.x v8, a1 -; CHECK-NEXT: li a1, 1024 +; CHECK-NEXT: lui a1, 1 +; CHECK-NEXT: add a1, a0, a1 ; CHECK-NEXT: .LBB64_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v9, (a0) @@ -3542,9 +3543,8 @@ ; CHECK-NEXT: vrem.vv v9, v8, v9, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v9, (a0) -; CHECK-NEXT: addi a1, a1, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a1, .LBB64_1 +; CHECK-NEXT: bne a0, a1, .LBB64_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3571,7 +3571,8 @@ define void @sink_splat_vp_fma(ptr noalias nocapture %a, ptr nocapture readonly %b, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fma: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a1, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB65_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3581,10 +3582,9 @@ ; CHECK-NEXT: vfmadd.vf v8, fa0, v9, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a1, a1, 16 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB65_1 +; CHECK-NEXT: bne a1, a3, .LBB65_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3611,7 +3611,8 @@ define void @sink_splat_vp_fma_commute(ptr noalias nocapture %a, ptr nocapture readonly %b, float %x, <4 x i1> %m, i32 zeroext %vl) { ; CHECK-LABEL: sink_splat_vp_fma_commute: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a1, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: .LBB66_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3621,10 +3622,9 @@ ; CHECK-NEXT: vfmadd.vf v8, fa0, v9, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a1, a1, 16 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB66_1 +; CHECK-NEXT: bne a1, a3, .LBB66_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3652,16 +3652,16 @@ define void @sink_splat_mul_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_mul_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB67_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vmul.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB67_1 +; CHECK-NEXT: bne a0, a2, .LBB67_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3686,16 +3686,16 @@ define void @sink_splat_add_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_add_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB68_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vadd.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB68_1 +; CHECK-NEXT: bne a0, a2, .LBB68_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3720,16 +3720,16 @@ define void @sink_splat_sub_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_sub_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB69_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vsub.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB69_1 +; CHECK-NEXT: bne a0, a2, .LBB69_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3754,16 +3754,16 @@ define void @sink_splat_rsub_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_rsub_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB70_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vrsub.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB70_1 +; CHECK-NEXT: bne a0, a2, .LBB70_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3788,16 +3788,16 @@ define void @sink_splat_and_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_and_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB71_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vand.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB71_1 +; CHECK-NEXT: bne a0, a2, .LBB71_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3822,16 +3822,16 @@ define void @sink_splat_or_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_or_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB72_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vor.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB72_1 +; CHECK-NEXT: bne a0, a2, .LBB72_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3856,16 +3856,16 @@ define void @sink_splat_xor_lmul2(ptr nocapture %a, i64 signext %x) { ; CHECK-LABEL: sink_splat_xor_lmul2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma ; CHECK-NEXT: .LBB73_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle64.v v8, (a0) ; CHECK-NEXT: vxor.vx v8, v8, a1 ; CHECK-NEXT: vse64.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB73_1 +; CHECK-NEXT: bne a0, a2, .LBB73_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3890,7 +3890,8 @@ define void @sink_splat_mul_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_mul_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB74_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3898,9 +3899,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vmul.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB74_1 +; CHECK-NEXT: bne a0, a2, .LBB74_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3925,7 +3925,8 @@ define void @sink_splat_add_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_add_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB75_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3933,9 +3934,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vadd.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB75_1 +; CHECK-NEXT: bne a0, a2, .LBB75_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3960,7 +3960,8 @@ define void @sink_splat_sub_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_sub_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB76_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -3968,9 +3969,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB76_1 +; CHECK-NEXT: bne a0, a2, .LBB76_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -3995,7 +3995,8 @@ define void @sink_splat_rsub_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_rsub_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB77_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -4003,9 +4004,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vrsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB77_1 +; CHECK-NEXT: bne a0, a2, .LBB77_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4030,7 +4030,8 @@ define void @sink_splat_and_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_and_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB78_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -4038,9 +4039,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vand.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB78_1 +; CHECK-NEXT: bne a0, a2, .LBB78_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4065,7 +4065,8 @@ define void @sink_splat_or_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_or_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB79_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -4073,9 +4074,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB79_1 +; CHECK-NEXT: bne a0, a2, .LBB79_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4100,7 +4100,8 @@ define void @sink_splat_xor_lmul8(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_xor_lmul8: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: li a3, 32 ; CHECK-NEXT: .LBB80_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 @@ -4108,9 +4109,8 @@ ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vxor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB80_1 +; CHECK-NEXT: bne a0, a2, .LBB80_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4135,16 +4135,16 @@ define void @sink_splat_mul_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_mul_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB81_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vmul.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB81_1 +; CHECK-NEXT: bne a0, a2, .LBB81_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4169,16 +4169,16 @@ define void @sink_splat_add_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_add_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB82_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vadd.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB82_1 +; CHECK-NEXT: bne a0, a2, .LBB82_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4203,16 +4203,16 @@ define void @sink_splat_sub_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_sub_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB83_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB83_1 +; CHECK-NEXT: bne a0, a2, .LBB83_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4237,16 +4237,16 @@ define void @sink_splat_rsub_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_rsub_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB84_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vrsub.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB84_1 +; CHECK-NEXT: bne a0, a2, .LBB84_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4271,16 +4271,16 @@ define void @sink_splat_and_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_and_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB85_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vand.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB85_1 +; CHECK-NEXT: bne a0, a2, .LBB85_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4305,16 +4305,16 @@ define void @sink_splat_or_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_or_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB86_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB86_1 +; CHECK-NEXT: bne a0, a2, .LBB86_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4339,16 +4339,16 @@ define void @sink_splat_xor_lmulmf2(ptr nocapture %a, i32 signext %x) { ; CHECK-LABEL: sink_splat_xor_lmulmf2: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma ; CHECK-NEXT: .LBB87_1: # %vector.body ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: vle32.v v8, (a0) ; CHECK-NEXT: vxor.vx v8, v8, a1 ; CHECK-NEXT: vse32.v v8, (a0) -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 32 -; CHECK-NEXT: bnez a2, .LBB87_1 +; CHECK-NEXT: bne a0, a2, .LBB87_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4376,7 +4376,8 @@ ; CHECK-LABEL: sink_splat_vp_icmp: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vmv1r.v v8, v0 -; CHECK-NEXT: li a3, 1024 +; CHECK-NEXT: lui a3, 1 +; CHECK-NEXT: add a3, a0, a3 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vmv.v.i v9, 0 ; CHECK-NEXT: .LBB88_1: # %vector.body @@ -4387,9 +4388,8 @@ ; CHECK-NEXT: vmseq.vx v0, v10, a1, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v9, (a0), v0.t -; CHECK-NEXT: addi a3, a3, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a3, .LBB88_1 +; CHECK-NEXT: bne a0, a3, .LBB88_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: @@ -4417,7 +4417,8 @@ ; CHECK-LABEL: sink_splat_vp_fcmp: ; CHECK: # %bb.0: # %entry ; CHECK-NEXT: vmv1r.v v8, v0 -; CHECK-NEXT: li a2, 1024 +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: add a2, a0, a2 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vmv.v.i v9, 0 ; CHECK-NEXT: .LBB89_1: # %vector.body @@ -4428,9 +4429,8 @@ ; CHECK-NEXT: vmfeq.vf v0, v10, fa0, v0.t ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma ; CHECK-NEXT: vse32.v v9, (a0), v0.t -; CHECK-NEXT: addi a2, a2, -4 ; CHECK-NEXT: addi a0, a0, 16 -; CHECK-NEXT: bnez a2, .LBB89_1 +; CHECK-NEXT: bne a0, a2, .LBB89_1 ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup ; CHECK-NEXT: ret entry: