Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h =================================================================== --- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -377,6 +377,11 @@ return 1 << (VSEW + 3); } +inline static unsigned encodeSEW(unsigned SEW) { + assert(isValidSEW(SEW) && "Unspected SEW value"); + return Log2_32(SEW) - 3; +} + inline static unsigned getSEW(unsigned VType) { unsigned VSEW = (VType >> 3) & 0x7; return decodeVSEW(VSEW); Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp =================================================================== --- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp +++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp @@ -131,7 +131,7 @@ bool TailAgnostic, bool MaskAgnostic) { assert(isValidSEW(SEW) && "Invalid SEW"); unsigned VLMULBits = static_cast(VLMUL); - unsigned VSEWBits = Log2_32(SEW) - 3; + unsigned VSEWBits = encodeSEW(SEW); unsigned VTypeI = (VSEWBits << 3) | (VLMULBits & 0x7); if (TailAgnostic) VTypeI |= 0x40; Index: llvm/lib/Target/RISCV/RISCVISelLowering.h =================================================================== --- llvm/lib/Target/RISCV/RISCVISelLowering.h +++ llvm/lib/Target/RISCV/RISCVISelLowering.h @@ -321,6 +321,10 @@ }; } // namespace RISCVISD +namespace RISCV { +// We use 64 bits as the known part in the scalable vector types. +static constexpr unsigned RVVBitsPerBlock = 64; +} // namespace RISCV class RISCVTargetLowering : public TargetLowering { const RISCVSubtarget &Subtarget; @@ -535,6 +539,15 @@ Optional CC) const override; static RISCVII::VLMUL getLMUL(MVT VT); + inline static unsigned computeVLMAX(unsigned VectorBits, unsigned EltSize, + unsigned MinSize) { + // Original equation: + // VLMAX = (VectorBits / EltSize) * LMUL + // where LMUL = MinSize / RISCV::RVVBitsPerBlock + // The following equations have been reordered to prevent loss of precision + // when calculating fractional LMUL. + return ((VectorBits / EltSize) * MinSize) / RISCV::RVVBitsPerBlock; + }; static unsigned getRegClassIDForLMUL(RISCVII::VLMUL LMul); static unsigned getSubregIndexByMVT(MVT VT, unsigned Index); static unsigned getRegClassIDForVecVT(MVT VT); @@ -675,12 +688,6 @@ return false; }; }; - -namespace RISCV { -// We use 64 bits as the known part in the scalable vector types. -static constexpr unsigned RVVBitsPerBlock = 64; -} // namespace RISCV - namespace RISCVVIntrinsicsTable { struct RISCVVIntrinsicInfo { Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp =================================================================== --- llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -4640,12 +4640,58 @@ DAG.getConstant(1, DL, XLenVT)); // Double the VL since we halved SEW. - SDValue VL = getVLOperand(Op); - SDValue I32VL = - DAG.getNode(ISD::SHL, DL, XLenVT, VL, DAG.getConstant(1, DL, XLenVT)); + SDValue AVL = getVLOperand(Op); + SDValue I32VL; + + // Optimize for constant AVL + if (isa(AVL)) { + unsigned EltSize = VT.getScalarSizeInBits(); + unsigned MinSize = VT.getSizeInBits().getKnownMinValue(); + + unsigned VectorBitsMax = Subtarget.getRealMaxVLen(); + unsigned MaxVLMAX = + RISCVTargetLowering::computeVLMAX(VectorBitsMax, EltSize, MinSize); + + unsigned VectorBitsMin = Subtarget.getRealMinVLen(); + unsigned MinVLMAX = + RISCVTargetLowering::computeVLMAX(VectorBitsMin, EltSize, MinSize); + + uint64_t AVLInt = cast(AVL)->getZExtValue(); + if (AVLInt <= MinVLMAX) { + I32VL = DAG.getConstant(2 * AVLInt, DL, XLenVT); + } else if (AVLInt >= 2 * MaxVLMAX) { + // Just set vl to VLMAX in this situation + RISCVII::VLMUL Lmul = RISCVTargetLowering::getLMUL(I32VT); + SDValue LMUL = DAG.getConstant(Lmul, DL, XLenVT); + unsigned Sew = RISCVVType::encodeSEW(I32VT.getScalarSizeInBits()); + SDValue SEW = DAG.getConstant(Sew, DL, XLenVT); + SDValue SETVLMAX = DAG.getTargetConstant( + Intrinsic::riscv_vsetvlimax_opt, DL, MVT::i32); + I32VL = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, XLenVT, SETVLMAX, SEW, + LMUL); + } else { + // For AVL between (MinVLMAX, 2 * MaxVLMAX), the actual working vl + // is related to the hardware implementation. + // So let the following code handle + } + } + if (!I32VL) { + RISCVII::VLMUL Lmul = RISCVTargetLowering::getLMUL(VT); + SDValue LMUL = DAG.getConstant(Lmul, DL, XLenVT); + unsigned Sew = RISCVVType::encodeSEW(VT.getScalarSizeInBits()); + SDValue SEW = DAG.getConstant(Sew, DL, XLenVT); + SDValue SETVL = + DAG.getTargetConstant(Intrinsic::riscv_vsetvli_opt, DL, MVT::i32); + // Using vsetvl instruction to get actually used length which related to + // the hardware implementation + SDValue VL = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, XLenVT, SETVL, AVL, + SEW, LMUL); + I32VL = + DAG.getNode(ISD::SHL, DL, XLenVT, VL, DAG.getConstant(1, DL, XLenVT)); + } MVT I32MaskVT = MVT::getVectorVT(MVT::i1, I32VT.getVectorElementCount()); - SDValue I32Mask = DAG.getNode(RISCVISD::VMSET_VL, DL, I32MaskVT, VL); + SDValue I32Mask = DAG.getNode(RISCVISD::VMSET_VL, DL, I32MaskVT, AVL); // Shift the two scalar parts in using SEW=32 slide1up/slide1down // instructions. @@ -4685,10 +4731,11 @@ // TAMU if (Policy == RISCVII::TAIL_AGNOSTIC) return DAG.getNode(RISCVISD::VSELECT_VL, DL, VT, Mask, Vec, MaskedOff, - VL); + AVL); // TUMA or TUMU: Currently we always emit tumu policy regardless of tuma. // It's fine because vmerge does not care mask policy. - return DAG.getNode(RISCVISD::VP_MERGE_VL, DL, VT, Mask, Vec, MaskedOff, VL); + return DAG.getNode(RISCVISD::VP_MERGE_VL, DL, VT, Mask, Vec, MaskedOff, + AVL); } } @@ -5551,7 +5598,8 @@ unsigned MaxVLMAX = 0; unsigned VectorBitsMax = Subtarget.getMaxRVVVectorSizeInBits(); if (VectorBitsMax != 0) - MaxVLMAX = ((VectorBitsMax / EltSize) * MinSize) / RISCV::RVVBitsPerBlock; + MaxVLMAX = + RISCVTargetLowering::computeVLMAX(VectorBitsMax, EltSize, MinSize); unsigned GatherOpc = RISCVISD::VRGATHER_VV_VL; MVT IntVT = VecVT.changeVectorElementTypeToInteger(); Index: llvm/lib/Target/RISCV/RISCVSubtarget.h =================================================================== --- llvm/lib/Target/RISCV/RISCVSubtarget.h +++ llvm/lib/Target/RISCV/RISCVSubtarget.h @@ -206,6 +206,15 @@ return 0; } unsigned getMinVLen() const { return ZvlLen; } + unsigned getMaxVLen() const { return Zvl65536b; } + unsigned getRealMinVLen() const { + unsigned VLen = getMinRVVVectorSizeInBits(); + return VLen != 0 ? VLen : getMinVLen(); + } + unsigned getRealMaxVLen() const { + unsigned VLen = getMaxRVVVectorSizeInBits(); + return VLen != 0 ? VLen : getMaxVLen(); + } RISCVABI::ABI getTargetABI() const { return TargetABI; } bool isRegisterReservedByUser(Register i) const { assert(i < RISCV::NUM_TARGET_REGS && "Register out of range"); Index: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vslide1-rv32.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vslide1-rv32.ll @@ -0,0 +1,512 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -riscv-v-vector-bits-min=256 -riscv-v-vector-bits-max=256 \ +; RUN: -mattr=+v -verify-machineinstrs \ +; RUN: < %s | FileCheck %s --check-prefixes=CHECK,CHECK-256 + +; RUN: llc -mtriple=riscv32 -riscv-v-vector-bits-min=512 -riscv-v-vector-bits-max=1024 \ +; RUN: -mattr=+v -verify-machineinstrs \ +; RUN: < %s | FileCheck %s --check-prefixes=CHECK,CHECK-512-1024 + +; RUN: llc -mtriple=riscv32 -riscv-v-vector-bits-min=64 -riscv-v-vector-bits-max=64 \ +; RUN: -mattr=+zve64x -verify-machineinstrs \ +; RUN: < %s | FileCheck %s --check-prefixes=CHECK-64 + +declare @llvm.riscv.vslide1up.nxv1i64.i64( + , + , + i64, + i32) + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl1( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 2, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl1: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetivli zero, 2, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 1) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl4( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 8, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl4: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 4) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl5( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetivli a2, 5, e64, m1, ta, mu +; CHECK-256-NEXT: slli a2, a2, 1 +; CHECK-256-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 10, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 5) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl7( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetivli a2, 7, e64, m1, ta, mu +; CHECK-256-NEXT: slli a2, a2, 1 +; CHECK-256-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 14, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 7) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl8( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 16, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 8) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl9( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 9, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 9) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl15( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 15, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 15) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_v16( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-256-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 16, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-512-1024-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-64-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 16) + + ret %a +} + +declare @llvm.riscv.vslide1down.nxv1i64.i64( + , + , + i64, + i32) + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl4( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 8, e32, m1, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl4: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 4) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl5( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetivli a2, 5, e64, m1, ta, mu +; CHECK-256-NEXT: slli a2, a2, 1 +; CHECK-256-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 10, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl5: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 5) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl7( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetivli a2, 7, e64, m1, ta, mu +; CHECK-256-NEXT: slli a2, a2, 1 +; CHECK-256-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 14, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl7: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 7) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl8( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli zero, 16, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl8: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 8) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl9( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 9, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl9: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 9) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl15( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 15, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl15: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 15) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_v16( %0, i64 %1) nounwind { +; CHECK-256-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-256: # %bb.0: # %entry +; CHECK-256-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-256-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-256-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-256-NEXT: ret +; +; CHECK-512-1024-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-512-1024: # %bb.0: # %entry +; CHECK-512-1024-NEXT: vsetivli a2, 16, e64, m1, ta, mu +; CHECK-512-1024-NEXT: slli a2, a2, 1 +; CHECK-512-1024-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-512-1024-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-512-1024-NEXT: ret +; +; CHECK-64-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_v16: +; CHECK-64: # %bb.0: # %entry +; CHECK-64-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-64-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-64-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-64-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 16) + + ret %a +} Index: llvm/test/CodeGen/RISCV/rvv/masked-vslide1down-rv32.ll =================================================================== --- llvm/test/CodeGen/RISCV/rvv/masked-vslide1down-rv32.ll +++ llvm/test/CodeGen/RISCV/rvv/masked-vslide1down-rv32.ll @@ -13,7 +13,8 @@ define @intrinsic_vslide1down_mask_tumu_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_tumu_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v9, v9, a0 ; CHECK-NEXT: vslide1down.vx v9, v9, a1 @@ -34,7 +35,8 @@ define @intrinsic_vslide1down_mask_tamu_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_tamu_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v9, v9, a0 ; CHECK-NEXT: vslide1down.vx v9, v9, a1 @@ -57,7 +59,8 @@ define @intrinsic_vslide1down_mask_tuma_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_tuma_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v9, v9, a0 ; CHECK-NEXT: vslide1down.vx v9, v9, a1 @@ -79,6 +82,7 @@ define @intrinsic_vslide1down_mask_tama_vx_nxv1i64_nxv1i64_i64( %0, i64 %1, %2, i32 %3) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_tama_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 @@ -98,6 +102,7 @@ define @intrinsic_vslide1down_mask_tama_undef_mask_vx_nxv1i64_nxv1i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_tama_undef_mask_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 Index: llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll =================================================================== --- llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll +++ llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll @@ -886,6 +886,7 @@ define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, iXLen %3) nounwind { ; RV32-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64: ; RV32: # %bb.0: # %entry +; RV32-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; RV32-NEXT: slli a2, a2, 1 ; RV32-NEXT: vsetvli zero, a2, e32, m1, tu, mu ; RV32-NEXT: vmv1r.v v10, v8 @@ -917,6 +918,7 @@ define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, iXLen %3) nounwind { ; RV32-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64: ; RV32: # %bb.0: # %entry +; RV32-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; RV32-NEXT: slli a2, a2, 1 ; RV32-NEXT: vsetvli zero, a2, e32, m1, tu, mu ; RV32-NEXT: vmv1r.v v10, v8 Index: llvm/test/CodeGen/RISCV/rvv/vslide1down-rv32.ll =================================================================== --- llvm/test/CodeGen/RISCV/rvv/vslide1down-rv32.ll +++ llvm/test/CodeGen/RISCV/rvv/vslide1down-rv32.ll @@ -856,6 +856,7 @@ define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 @@ -871,6 +872,79 @@ ret %a } +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl3( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 3, e64, m1, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 3) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2047( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2047: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li a2, 2047 +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2047) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2048( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv1i64_nxv1i64_i64_vl2048: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2048) + + ret %a +} + declare @llvm.riscv.vslide1down.mask.nxv1i64.i64( , , @@ -882,7 +956,8 @@ define @intrinsic_vslide1down_mask_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m1, ta, mu ; CHECK-NEXT: vslide1down.vx v9, v9, a0 ; CHECK-NEXT: vslide1down.vx v9, v9, a1 @@ -909,6 +984,7 @@ define @intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m2, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 @@ -924,6 +1000,80 @@ ret %a } +define @intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl5( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl5: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 5, e64, m2, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 5) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4095( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4095: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m2, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4095) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4096( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv2i64_nxv2i64_i64_vl4096: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4096) + + ret %a +} + declare @llvm.riscv.vslide1down.mask.nxv2i64.i64( , , @@ -935,7 +1085,8 @@ define @intrinsic_vslide1down_mask_vx_nxv2i64_nxv2i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_vx_nxv2i64_nxv2i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m2, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m2, ta, mu ; CHECK-NEXT: vslide1down.vx v10, v10, a0 ; CHECK-NEXT: vslide1down.vx v10, v10, a1 @@ -962,6 +1113,7 @@ define @intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m4, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 @@ -977,6 +1129,80 @@ ret %a } +define @intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl9( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl9: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 9, e64, m4, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 9) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8191( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8191: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m4, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8191) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8192( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv4i64_nxv4i64_i64_vl8192: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m4, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8192) + + ret %a +} + declare @llvm.riscv.vslide1down.mask.nxv4i64.i64( , , @@ -988,7 +1214,8 @@ define @intrinsic_vslide1down_mask_vx_nxv4i64_nxv4i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_vx_nxv4i64_nxv4i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m4, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m4, ta, mu ; CHECK-NEXT: vslide1down.vx v12, v12, a0 ; CHECK-NEXT: vslide1down.vx v12, v12, a1 @@ -1015,6 +1242,7 @@ define @intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m8, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu ; CHECK-NEXT: vslide1down.vx v8, v8, a0 @@ -1030,6 +1258,81 @@ ret %a } +define @intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl16( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li a2, 32 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl17( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl17: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 17, e64, m8, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 17) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_v16383( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_v16383: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 4 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m8, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16383) + + ret %a +} + +define @intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl16384( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1down_vx_nxv8i64_nxv8i64_i64_vl16384: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m8, ta, mu +; CHECK-NEXT: vslide1down.vx v8, v8, a0 +; CHECK-NEXT: vslide1down.vx v8, v8, a1 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1down.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16384) + + ret %a +} + declare @llvm.riscv.vslide1down.mask.nxv8i64.i64( , , @@ -1041,7 +1344,8 @@ define @intrinsic_vslide1down_mask_vx_nxv8i64_nxv8i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1down_mask_vx_nxv8i64_nxv8i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m8, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, mu ; CHECK-NEXT: vslide1down.vx v16, v16, a0 ; CHECK-NEXT: vslide1down.vx v16, v16, a1 Index: llvm/test/CodeGen/RISCV/rvv/vslide1up-rv32.ll =================================================================== --- llvm/test/CodeGen/RISCV/rvv/vslide1up-rv32.ll +++ llvm/test/CodeGen/RISCV/rvv/vslide1up-rv32.ll @@ -874,6 +874,7 @@ define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu ; CHECK-NEXT: vslide1up.vx v9, v8, a1 @@ -889,6 +890,79 @@ ret %a } +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl3( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 3, e64, m1, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 3) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2047( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2047: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li a2, 2047 +; CHECK-NEXT: vsetvli a2, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2047) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2048( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv1i64_nxv1i64_i64_vl2048: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m1, ta, mu +; CHECK-NEXT: vslide1up.vx v9, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v9, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv1i64.i64( + undef, + %0, + i64 %1, + i32 2048) + + ret %a +} + declare @llvm.riscv.vslide1up.mask.nxv1i64.i64( , , @@ -900,7 +974,8 @@ define @intrinsic_vslide1up_mask_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_mask_vx_nxv1i64_nxv1i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m1, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m1, ta, mu ; CHECK-NEXT: vslide1up.vx v10, v9, a1 ; CHECK-NEXT: vslide1up.vx v9, v10, a0 @@ -927,6 +1002,7 @@ define @intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m2, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu ; CHECK-NEXT: vslide1up.vx v10, v8, a1 @@ -942,6 +1018,80 @@ ret %a } +define @intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, mu +; CHECK-NEXT: vslide1up.vx v10, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v10, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl5( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl5: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 5, e64, m2, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu +; CHECK-NEXT: vslide1up.vx v10, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v10, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 5) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4095( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4095: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 1 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m2, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m2, ta, mu +; CHECK-NEXT: vslide1up.vx v10, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v10, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4095) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4096( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv2i64_nxv2i64_i64_vl4096: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m2, ta, mu +; CHECK-NEXT: vslide1up.vx v10, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v10, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv2i64.i64( + undef, + %0, + i64 %1, + i32 4096) + + ret %a +} + declare @llvm.riscv.vslide1up.mask.nxv2i64.i64( , , @@ -953,7 +1103,8 @@ define @intrinsic_vslide1up_mask_vx_nxv2i64_nxv2i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_mask_vx_nxv2i64_nxv2i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m2, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m2, ta, mu ; CHECK-NEXT: vslide1up.vx v12, v10, a1 ; CHECK-NEXT: vslide1up.vx v10, v12, a0 @@ -980,6 +1131,7 @@ define @intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m4, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu ; CHECK-NEXT: vslide1up.vx v12, v8, a1 @@ -995,6 +1147,80 @@ ret %a } +define @intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, mu +; CHECK-NEXT: vslide1up.vx v12, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v12, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl9( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl9: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 9, e64, m4, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu +; CHECK-NEXT: vslide1up.vx v12, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v12, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 9) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8191( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8191: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 2 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m4, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m4, ta, mu +; CHECK-NEXT: vslide1up.vx v12, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v12, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8191) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8192( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv4i64_nxv4i64_i64_vl8192: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m4, ta, mu +; CHECK-NEXT: vslide1up.vx v12, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v12, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv4i64.i64( + undef, + %0, + i64 %1, + i32 8192) + + ret %a +} + declare @llvm.riscv.vslide1up.mask.nxv4i64.i64( , , @@ -1006,7 +1232,8 @@ define @intrinsic_vslide1up_mask_vx_nxv4i64_nxv4i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_mask_vx_nxv4i64_nxv4i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m4, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m4, ta, mu ; CHECK-NEXT: vslide1up.vx v16, v12, a1 ; CHECK-NEXT: vslide1up.vx v12, v16, a0 @@ -1033,6 +1260,7 @@ define @intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64( %0, i64 %1, i32 %2) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64: ; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, a2, e64, m8, ta, mu ; CHECK-NEXT: slli a2, a2, 1 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu ; CHECK-NEXT: vslide1up.vx v16, v8, a1 @@ -1048,6 +1276,81 @@ ret %a } +define @intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl16( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li a2, 32 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1up.vx v16, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v16, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl17( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl17: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli a2, 17, e64, m8, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1up.vx v16, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v16, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 17) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_v16383( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_v16383: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: lui a2, 4 +; CHECK-NEXT: addi a2, a2, -1 +; CHECK-NEXT: vsetvli a2, a2, e64, m8, ta, mu +; CHECK-NEXT: slli a2, a2, 1 +; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, mu +; CHECK-NEXT: vslide1up.vx v16, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v16, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16383) + + ret %a +} + +define @intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl16384( %0, i64 %1) nounwind { +; CHECK-LABEL: intrinsic_vslide1up_vx_nxv8i64_nxv8i64_i64_vl16384: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli a2, zero, e32, m8, ta, mu +; CHECK-NEXT: vslide1up.vx v16, v8, a1 +; CHECK-NEXT: vslide1up.vx v8, v16, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vslide1up.nxv8i64.i64( + undef, + %0, + i64 %1, + i32 16384) + + ret %a +} + declare @llvm.riscv.vslide1up.mask.nxv8i64.i64( , , @@ -1059,7 +1362,8 @@ define @intrinsic_vslide1up_mask_vx_nxv8i64_nxv8i64_i64( %0, %1, i64 %2, %3, i32 %4) nounwind { ; CHECK-LABEL: intrinsic_vslide1up_mask_vx_nxv8i64_nxv8i64_i64: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: slli a3, a2, 1 +; CHECK-NEXT: vsetvli a3, a2, e64, m8, ta, mu +; CHECK-NEXT: slli a3, a3, 1 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, mu ; CHECK-NEXT: vslide1up.vx v24, v16, a1 ; CHECK-NEXT: vslide1up.vx v16, v24, a0