diff --git a/llvm/include/llvm/IR/IntrinsicsRISCV.td b/llvm/include/llvm/IR/IntrinsicsRISCV.td --- a/llvm/include/llvm/IR/IntrinsicsRISCV.td +++ b/llvm/include/llvm/IR/IntrinsicsRISCV.td @@ -604,6 +604,17 @@ } // For Saturating binary operations. // The destination vector type is the same as first source vector. + // Input: (passthru, vector_in, vector_in/scalar_in, vl, vxrm) + class RISCVSaturatingBinaryRMAAXNoMask + : Intrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty, + llvm_anyint_ty, LLVMMatchType<2>], + [ImmArg>, IntrNoMem]>, RISCVVIntrinsic { + let SplatOperand = 2; + let VLOperand = 3; + } + // For Saturating binary operations. + // The destination vector type is the same as first source vector. // Input: (passthru, vector_in, vector_in/scalar_in, vl) class RISCVSaturatingBinaryAAXNoMask : Intrinsic<[llvm_anyvector_ty], @@ -625,6 +636,18 @@ let SplatOperand = 2; let VLOperand = 4; } + // For Saturating binary operations with mask. + // The destination vector type is the same as first source vector. + // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl, policy, vxrm) + class RISCVSaturatingBinaryRMAAXMask + : Intrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty, + LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty, + LLVMMatchType<2>, LLVMMatchType<2>], + [ImmArg>, ImmArg>, IntrNoMem]>, RISCVVIntrinsic { + let SplatOperand = 2; + let VLOperand = 4; + } // For Saturating binary operations. // The destination vector type is the same as first source vector. // The second source operand matches the destination type or is an XLen scalar. @@ -1087,6 +1110,10 @@ multiclass RISCVBinaryMaskOut { def "int_riscv_" # NAME : RISCVBinaryMOut; } + multiclass RISCVSaturatingBinaryRMAAX { + def "int_riscv_" # NAME : RISCVSaturatingBinaryRMAAXNoMask; + def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryRMAAXMask; + } multiclass RISCVSaturatingBinaryAAX { def "int_riscv_" # NAME : RISCVSaturatingBinaryAAXNoMask; def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryAAXMask; @@ -1372,6 +1399,7 @@ defm vaaddu : RISCVSaturatingBinaryAAX; defm vaadd : RISCVSaturatingBinaryAAX; + defm vaadd_rm : RISCVSaturatingBinaryRMAAX; defm vasubu : RISCVSaturatingBinaryAAX; defm vasub : RISCVSaturatingBinaryAAX; diff --git a/llvm/lib/Target/RISCV/CMakeLists.txt b/llvm/lib/Target/RISCV/CMakeLists.txt --- a/llvm/lib/Target/RISCV/CMakeLists.txt +++ b/llvm/lib/Target/RISCV/CMakeLists.txt @@ -26,6 +26,7 @@ RISCVFrameLowering.cpp RISCVGatherScatterLowering.cpp RISCVInsertVSETVLI.cpp + RISCVVXRMRegister.cpp RISCVInstrInfo.cpp RISCVInstructionSelector.cpp RISCVISelDAGToDAG.cpp diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -88,6 +88,9 @@ // Pseudos. IsRVVWideningReductionShift = HasVecPolicyOpShift + 1, IsRVVWideningReductionMask = 1 << IsRVVWideningReductionShift, + + HasRoundModeOpShift = IsRVVWideningReductionShift + 1, + HasRoundModeOpMask = 1 << HasRoundModeOpShift, }; // Match with the definitions in RISCVInstrFormatsV.td @@ -156,7 +159,9 @@ static inline bool isRVVWideningReduction(uint64_t TSFlags) { return TSFlags & IsRVVWideningReductionMask; } - +static inline bool hasRoundModeOp(uint64_t TSFlags) { + return TSFlags & HasRoundModeOpMask; +} // RISC-V Specific Machine Operand Flags enum { MO_None = 0, @@ -268,6 +273,17 @@ } } // namespace RISCVFPRndMode +namespace RISCVVXRndMode { +enum RoundingMode { + RNU = 0, + RNE = 1, + RDN = 2, + ROD = 3, + DYN = 4, +}; + +} // namespace RISCVVXRndMode + namespace RISCVSysReg { struct SysReg { const char *Name; diff --git a/llvm/lib/Target/RISCV/RISCV.h b/llvm/lib/Target/RISCV/RISCV.h --- a/llvm/lib/Target/RISCV/RISCV.h +++ b/llvm/lib/Target/RISCV/RISCV.h @@ -55,6 +55,9 @@ FunctionPass *createRISCVInsertVSETVLIPass(); void initializeRISCVInsertVSETVLIPass(PassRegistry &); +FunctionPass *createRISCVVXRMRegisterPass(); +void initializeRISCVVXRMRegisterPass(PassRegistry &); + FunctionPass *createRISCVRedundantCopyEliminationPass(); void initializeRISCVRedundantCopyEliminationPass(PassRegistry &); diff --git a/llvm/lib/Target/RISCV/RISCVInstrFormats.td b/llvm/lib/Target/RISCV/RISCVInstrFormats.td --- a/llvm/lib/Target/RISCV/RISCVInstrFormats.td +++ b/llvm/lib/Target/RISCV/RISCVInstrFormats.td @@ -197,6 +197,9 @@ bit IsRVVWideningReduction = 0; let TSFlags{17} = IsRVVWideningReduction; + + bit HasRoundModeOp = 0; + let TSFlags{18} = HasRoundModeOp; } // Pseudo instructions diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -1389,6 +1389,11 @@ def WriteFRM : WriteSysReg; def WriteFRMImm : WriteSysRegImm; +def ReadVXRM : ReadSysReg; +def WriteVXRM : WriteSysReg; +def WriteVXRMImm : WriteSysRegImm; +def SwapVXRMImm : SwapSysRegImm; + let hasSideEffects = true in { def ReadFFLAGS : ReadSysReg; def WriteFFLAGS : WriteSysReg; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -42,6 +42,7 @@ defvar TAIL_UNDISTURBED = 0; defvar TAIL_AGNOSTIC = 1; +defvar VXRM_DYN = 4; //===----------------------------------------------------------------------===// // Utilities. @@ -1747,6 +1748,29 @@ } } +multiclass VPseudoBinaryRM { + let VLMul = MInfo.value, HasRoundModeOp = 1 in { + let InOperandList = (ins Op1Class:$rs2, Op2Class:$rs1, + ixlenimm:$rm, AVL:$vl, ixlenimm:$sew) in + def "_" # MInfo.MX : VPseudoBinaryNoMask; + let InOperandList = (ins RetClass:$merge, Op1Class:$rs2, Op2Class:$rs1, + ixlenimm:$rm, AVL:$vl, ixlenimm:$sew) in + def "_" # MInfo.MX # "_TU" : VPseudoBinaryNoMaskTU; + let InOperandList = (ins GetVRegNoV0.R:$merge, + Op1Class:$rs2, Op2Class:$rs1, + VMaskOp:$vm, ixlenimm:$rm, AVL:$vl, ixlenimm:$sew, ixlenimm:$policy) in + def "_" # MInfo.MX # "_MASK" : VPseudoBinaryMaskPolicy, + RISCVMaskedPseudo; + } +} + multiclass VPseudoBinaryM; } +multiclass VPseudoBinaryRM_V_VV { + foreach m = MxList in + defm _VV : VPseudoBinaryRM; +} + // Similar to VPseudoBinaryV_VV, but uses MxListF. multiclass VPseudoBinaryFV_VV { foreach m = MxListF in @@ -1823,6 +1852,11 @@ defm "_VX" : VPseudoBinary; } +multiclass VPseudoBinaryRM_V_VX { + foreach m = MxList in + defm "_VX" : VPseudoBinaryRM; +} + multiclass VPseudoVSLD1_VX { foreach m = MxList in defm "_VX" : VPseudoBinary, @@ -2232,6 +2266,13 @@ Sched<[WriteVAALUX, ReadVAALUV, ReadVAALUX, ReadVMask]>; } +multiclass VPseudoVAALU_RM_VV_VX { + defm "" : VPseudoBinaryRM_V_VV, + Sched<[WriteVAALUV, ReadVAALUV, ReadVAALUV, ReadVMask]>; + defm "" : VPseudoBinaryRM_V_VX, + Sched<[WriteVAALUX, ReadVAALUV, ReadVAALUX, ReadVMask]>; +} + multiclass VPseudoVMINMAX_VV_VX { defm "" : VPseudoBinaryV_VV, Sched<[WriteVICmpV, ReadVICmpV, ReadVICmpV, ReadVMask]>; @@ -3001,6 +3042,35 @@ (op2_type op2_kind:$rs2), GPR:$vl, sew)>; +multiclass VPatBinaryRMNoMaskTA { + def : Pat<(result_type (!cast(intrinsic_name) + (result_type (undef)), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + VLOpFrag)), + (!cast(inst) + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (XLenVT VXRM_DYN), GPR:$vl, sew)>; + def : Pat<(result_type (!cast(intrinsic_name # "_rm") + (result_type (undef)), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + VLOpFrag, + (XLenVT timm:$round))), + (!cast(inst) + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (XLenVT timm:$round), GPR:$vl, sew)>; +} + class VPatBinaryNoMaskTU; +multiclass VPatBinaryRMNoMaskTU { + def : Pat<(result_type (!cast(intrinsic_name) + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + VLOpFrag)), + (!cast(inst#"_TU") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (XLenVT VXRM_DYN), GPR:$vl, sew)>; + def : Pat<(result_type (!cast(intrinsic_name # "_rm") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + VLOpFrag, + (XLenVT timm:$round))), + (!cast(inst#"_TU") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (XLenVT timm:$round), GPR:$vl, sew)>; +} + // Same as above but source operands are swapped. class VPatBinaryNoMaskSwapped; +multiclass VPatBinaryRMMaskTA { + def : Pat<(result_type (!cast(intrinsic_name#"_mask") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (mask_type V0), + VLOpFrag, (XLenVT timm:$policy))), + (!cast(inst#"_MASK") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (mask_type V0), (XLenVT VXRM_DYN), GPR:$vl, sew, (XLenVT timm:$policy))>; + def : Pat<(result_type (!cast(intrinsic_name#"_rm_mask") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (mask_type V0), + VLOpFrag, (XLenVT timm:$policy), (XLenVT timm:$round))), + (!cast(inst#"_MASK") + (result_type result_reg_class:$merge), + (op1_type op1_reg_class:$rs1), + (op2_type op2_kind:$rs2), + (mask_type V0), (XLenVT timm:$round), GPR:$vl, sew, (XLenVT timm:$policy))>; +} + // Same as above but source operands are swapped. class VPatBinaryMaskSwapped; } +multiclass VPatBinaryRMTA +{ + defm : VPatBinaryRMNoMaskTA; + defm : VPatBinaryRMNoMaskTU; + defm : VPatBinaryRMMaskTA; +} + multiclass VPatBinarySwapped; } +multiclass VPatBinary_RM_V_VV vtilist> { + foreach vti = vtilist in + defm : VPatBinaryRMTA; +} + multiclass VPatBinaryV_VV_INT vtilist> { foreach vti = vtilist in { @@ -3568,6 +3733,17 @@ } } +multiclass VPatBinary_RM_V_VX vtilist> { + foreach vti = vtilist in { + defvar kind = "V"#vti.ScalarSuffix; + defm : VPatBinaryRMTA; + } +} + multiclass VPatBinaryV_VX_INT vtilist> { foreach vti = vtilist in @@ -3833,6 +4009,11 @@ : VPatBinaryV_VV, VPatBinaryV_VX; +multiclass VPatBinaryRM_V_VV_VX vtilist> + : VPatBinary_RM_V_VV, + VPatBinary_RM_V_VX; + multiclass VPatBinaryV_VX_VI vtilist> : VPatBinaryV_VX, @@ -4536,7 +4717,7 @@ //===----------------------------------------------------------------------===// let Uses = [VXRM], hasSideEffects = 1 in { defm PseudoVAADDU : VPseudoVAALU_VV_VX; - defm PseudoVAADD : VPseudoVAALU_VV_VX; + defm PseudoVAADD : VPseudoVAALU_RM_VV_VX; defm PseudoVASUBU : VPseudoVAALU_VV_VX; defm PseudoVASUB : VPseudoVAALU_VV_VX; } @@ -5141,7 +5322,7 @@ // 13.2. Vector Single-Width Averaging Add and Subtract //===----------------------------------------------------------------------===// defm : VPatBinaryV_VV_VX<"int_riscv_vaaddu", "PseudoVAADDU", AllIntegerVectors>; -defm : VPatBinaryV_VV_VX<"int_riscv_vaadd", "PseudoVAADD", AllIntegerVectors>; +defm : VPatBinaryRM_V_VV_VX<"int_riscv_vaadd", "PseudoVAADD", AllIntegerVectors>; defm : VPatBinaryV_VV_VX<"int_riscv_vasubu", "PseudoVASUBU", AllIntegerVectors>; defm : VPatBinaryV_VV_VX<"int_riscv_vasub", "PseudoVASUB", AllIntegerVectors>; diff --git a/llvm/lib/Target/RISCV/RISCVMCInstLower.cpp b/llvm/lib/Target/RISCV/RISCVMCInstLower.cpp --- a/llvm/lib/Target/RISCV/RISCVMCInstLower.cpp +++ b/llvm/lib/Target/RISCV/RISCVMCInstLower.cpp @@ -155,6 +155,8 @@ --NumOps; if (RISCVII::hasVLOp(TSFlags)) --NumOps; + if (RISCVII::hasRoundModeOp(TSFlags)) + --NumOps; if (RISCVII::hasSEWOp(TSFlags)) --NumOps; diff --git a/llvm/lib/Target/RISCV/RISCVSystemOperands.td b/llvm/lib/Target/RISCV/RISCVSystemOperands.td --- a/llvm/lib/Target/RISCV/RISCVSystemOperands.td +++ b/llvm/lib/Target/RISCV/RISCVSystemOperands.td @@ -350,7 +350,7 @@ //===----------------------------------------------------------------------===// def : SysReg<"vstart", 0x008>; def : SysReg<"vxsat", 0x009>; -def : SysReg<"vxrm", 0x00A>; +def SysRegVXRM : SysReg<"vxrm", 0x00A>; def : SysReg<"vcsr", 0x00F>; def : SysReg<"vl", 0xC20>; def : SysReg<"vtype", 0xC21>; diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp --- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp @@ -47,6 +47,7 @@ initializeRISCVSExtWRemovalPass(*PR); initializeRISCVExpandPseudoPass(*PR); initializeRISCVInsertVSETVLIPass(*PR); + initializeRISCVVXRMRegisterPass(*PR); } static StringRef computeDataLayout(const Triple &TT) { @@ -213,6 +214,7 @@ if (TM->getOptLevel() != CodeGenOpt::None) addPass(createRISCVMergeBaseOffsetOptPass()); addPass(createRISCVInsertVSETVLIPass()); + addPass(createRISCVVXRMRegisterPass()); } void RISCVPassConfig::addPostRegAlloc() { diff --git a/llvm/lib/Target/RISCV/RISCVVXRMRegister.cpp b/llvm/lib/Target/RISCV/RISCVVXRMRegister.cpp new file mode 100644 --- /dev/null +++ b/llvm/lib/Target/RISCV/RISCVVXRMRegister.cpp @@ -0,0 +1,172 @@ +//===- RISCVVXRMRegister.cpp - Insert WriteVXRM instructions +//---------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements a function pass that inserts SwapVXRM/WriteVXRM +// instructions where needed. +// +// The pass consists of a single pass over each basici block looking for VXRM +// usage that requires a WriteVXRM to be inserted. +// +// Since ABI doesn't specify if VXRM is required to be preserved by calls for +// the moment, to be defensive in current state we always keep the incoming VXRM +// value from predecessors and calls and use it when the RoundModeOperand is +// specified as RISCVVXRndMode::DYN. +// +// This can be enhanced later if the ABI specify it is volatile across calls. +// +// TODO: Future enhancements to this pass will take into account VXRM from +// predecessors. +// +//===----------------------------------------------------------------------===// + +#include "RISCV.h" +#include "RISCVSubtarget.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +using namespace llvm; + +#define DEBUG_TYPE "riscv-insert-writevxrm" +#define RISCV_INSERT_WRITEVXRM_NAME "RISCV Insert required VXRM values" +namespace { + +class RISCVVXRMRegister : public MachineFunctionPass { + const TargetInstrInfo *TII; + MachineRegisterInfo *MRI; + +public: + static char ID; + + RISCVVXRMRegister() : MachineFunctionPass(ID) { + initializeRISCVVXRMRegisterPass(*PassRegistry::getPassRegistry()); + } + bool runOnMachineFunction(MachineFunction &MF) override; + + void getAnalysisUsage(AnalysisUsage &AU) const override { + AU.setPreservesCFG(); + MachineFunctionPass::getAnalysisUsage(AU); + } + + StringRef getPassName() const override { return RISCV_INSERT_WRITEVXRM_NAME; } + +private: + bool emitWriteVXRM(MachineBasicBlock &MBB); + bool hasVXRMInfo(const MachineInstr &MI, unsigned &VXRMInfo) const; +}; + +} // end anonymous namespace + +char RISCVVXRMRegister::ID = 0; + +INITIALIZE_PASS(RISCVVXRMRegister, DEBUG_TYPE, RISCV_INSERT_WRITEVXRM_NAME, + false, false) + +bool RISCVVXRMRegister::hasVXRMInfo(const MachineInstr &MI, + unsigned &NewInfo) const { + uint64_t TSFlags = MI.getDesc().TSFlags; + bool HasRoundModeOp = RISCVII::hasRoundModeOp(TSFlags); + + if (HasRoundModeOp) { + unsigned NumOperands = MI.getNumExplicitOperands(); + bool HasPolicy = RISCVII::hasVecPolicyOp(TSFlags); + if (HasPolicy) + --NumOperands; + const MachineOperand &RoundModeOp = MI.getOperand(NumOperands - 3); + + NewInfo = RoundModeOp.getImm() & 0x7; + } + return HasRoundModeOp; +} + +bool RISCVVXRMRegister::emitWriteVXRM(MachineBasicBlock &MBB) { + bool MadeChange = false; + + // To be defensive we keep the incoming VXRM value when round mode is changed + // from RISCVVXRndMode::DYN + Register SavedVXRMReg = 0; + + // For now predecessor state is unknown, we use RISCVVXRndMode::DYN to + // represent the incoming VXRM value + unsigned CurVXRMImm = RISCVVXRndMode::DYN; + for (MachineInstr &MI : MBB) { + if (!MI.readsRegister(RISCV::VXRM) && !MI.isCall() && !MI.isInlineAsm()) + continue; + + unsigned NewVXRMImm; + if (hasVXRMInfo(MI, NewVXRMImm)) { + if (NewVXRMImm == CurVXRMImm) + continue; + + // If the current mode doesn't meet the requirement, we need to insert + // WriteVXRM + + if (CurVXRMImm == RISCVVXRndMode::DYN) { + assert(SavedVXRMReg == 0); + SavedVXRMReg = MRI->createVirtualRegister(&RISCV::GPRRegClass); + BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(RISCV::SwapVXRMImm), + SavedVXRMReg) + .addImm(NewVXRMImm); + CurVXRMImm = NewVXRMImm; + MadeChange = true; + continue; + } else if (NewVXRMImm != RISCVVXRndMode::DYN) { + BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(RISCV::WriteVXRMImm)) + .addImm(NewVXRMImm); + CurVXRMImm = NewVXRMImm; + continue; + } + } + + if (CurVXRMImm == RISCVVXRndMode::DYN) + continue; + + // Here handles Calls, Terminator, InlineAsm, and all ops + // which depend on saved VXRM + + assert(SavedVXRMReg); + BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(RISCV::WriteVXRM)) + .addReg(SavedVXRMReg); + + SavedVXRMReg = 0; + CurVXRMImm = RISCVVXRndMode::DYN; + } + + // Restore VXRM to previous saved value before leaving the block + if (SavedVXRMReg) { + MachineInstr &MI = MBB.back(); + if (MI.isTerminator()) { + BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(RISCV::WriteVXRM)) + .addReg(SavedVXRMReg); + } else { + BuildMI(&MBB, MBB.back().getDebugLoc(), TII->get(RISCV::WriteVXRM)) + .addReg(SavedVXRMReg); + } + } + + return MadeChange; +} + +bool RISCVVXRMRegister::runOnMachineFunction(MachineFunction &MF) { + // Skip if the vector extension is not enabled. + const RISCVSubtarget &ST = MF.getSubtarget(); + if (!ST.hasVInstructions()) + return false; + + TII = ST.getInstrInfo(); + MRI = &MF.getRegInfo(); + + bool Changed = false; + + for (MachineBasicBlock &MBB : MF) + Changed |= emitWriteVXRM(MBB); + + return Changed; +} + +FunctionPass *llvm::createRISCVVXRMRegisterPass() { + return new RISCVVXRMRegister(); +} diff --git a/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.ll b/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.ll @@ -0,0 +1,37 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s + +declare @llvm.riscv.vaadd.rm.nxv1i8.nxv1i8( + , + , + , + i64, + i64); + +; test1(A, B, C, vl) = ((A + B) / 2 + C + 1) / 2 +define @test1( %0, %1, %2, i64 %3) nounwind { +; CHECK-LABEL: test1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, mu +; CHECK-NEXT: csrrwi a0, vxrm, 2 +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: vaadd.vv v8, v8, v10 +; CHECK-NEXT: csrw vxrm, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i8.nxv1i8( + undef, + %0, + %1, + i64 %3, + i64 2) + %res = call @llvm.riscv.vaadd.rm.nxv1i8.nxv1i8( + undef, + %a, + %2, + i64 %3, + i64 0) + + ret %res +} diff --git a/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.mir b/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.mir new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/roundmode-insert.mir @@ -0,0 +1,95 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py +# RUN: llc %s -o - -mtriple=riscv64 -mattr=+v -run-pass=riscv-insert-writevxrm | FileCheck %s +--- +name: vaadd +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $v8, $v9, $x10 + + ; CHECK-LABEL: name: vaadd + ; CHECK: liveins: $v8, $v9, $x10 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:vr = COPY $v8 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vr = COPY $v9 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gprnox0 = COPY $x10 + ; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY2]], 69, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: [[SwapVXRMImm:%[0-9]+]]:gpr = SwapVXRMImm 2, implicit-def $vxrm, implicit $vxrm + ; CHECK-NEXT: [[PseudoVAADD_VV_MF8_:%[0-9]+]]:vr = PseudoVAADD_VV_MF8 [[COPY]], [[COPY1]], 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + ; CHECK-NEXT: $v8 = COPY [[PseudoVAADD_VV_MF8_]] + ; CHECK-NEXT: WriteVXRM [[SwapVXRMImm]], implicit-def $vxrm + ; CHECK-NEXT: PseudoRET implicit $v8 + %0:vr = COPY $v8 + %1:vr = COPY $v9 + %2:gprnox0 = COPY $x10 + dead $x0 = PseudoVSETVLI %2:gprnox0, 69, implicit-def $vl, implicit-def $vtype + %3:vr = PseudoVAADD_VV_MF8 %0:vr, %1:vr, 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + $v8 = COPY %3:vr + PseudoRET implicit $v8 +... +--- +name: vaadd_inlineasm +tracksRegLiveness: true +body: | + bb.0.entry: + liveins: $v8, $v9, $v10, $x10 + ; CHECK-LABEL: name: vaadd_inlineasm + ; CHECK: liveins: $v8, $v9, $v10, $x10 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gprnox0 = COPY $x10 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vr = COPY $v10 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vr = COPY $v9 + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:vr = COPY $v8 + ; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY]], 69, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: [[SwapVXRMImm:%[0-9]+]]:gpr = SwapVXRMImm 2, implicit-def $vxrm, implicit $vxrm + ; CHECK-NEXT: [[PseudoVAADD_VV_MF8_:%[0-9]+]]:vr = PseudoVAADD_VV_MF8 [[COPY3]], [[COPY2]], 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + ; CHECK-NEXT: WriteVXRM [[SwapVXRMImm]], implicit-def $vxrm + ; CHECK-NEXT: INLINEASM &"", 1 /* sideeffect attdialect */ + ; CHECK-NEXT: [[SwapVXRMImm1:%[0-9]+]]:gpr = SwapVXRMImm 0, implicit-def $vxrm, implicit $vxrm + ; CHECK-NEXT: [[PseudoVAADD_VV_MF8_1:%[0-9]+]]:vr = PseudoVAADD_VV_MF8 killed [[PseudoVAADD_VV_MF8_]], [[COPY1]], 0, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + ; CHECK-NEXT: $v8 = COPY [[PseudoVAADD_VV_MF8_1]] + ; CHECK-NEXT: WriteVXRM [[SwapVXRMImm1]], implicit-def $vxrm + ; CHECK-NEXT: PseudoRET implicit $v8 + %3:gprnox0 = COPY $x10 + %2:vr = COPY $v10 + %1:vr = COPY $v9 + %0:vr = COPY $v8 + dead $x0 = PseudoVSETVLI %3:gprnox0, 69, implicit-def $vl, implicit-def $vtype + %4:vr = PseudoVAADD_VV_MF8 %0:vr, %1:vr, 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + INLINEASM &"", 1 /* sideeffect attdialect */ + %5:vr = PseudoVAADD_VV_MF8 killed %4:vr, %2:vr, 0, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + $v8 = COPY %5:vr + PseudoRET implicit $v8 +... +--- +name: fallthrough_basicblock +tracksRegLiveness: true +body: | + ; CHECK-LABEL: name: fallthrough_basicblock + ; CHECK: bb.0.entry: + ; CHECK-NEXT: successors: %bb.1(0x80000000) + ; CHECK-NEXT: liveins: $v8, $v9, $x10 + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:vr = COPY $v8 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vr = COPY $v9 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gprnox0 = COPY $x10 + ; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY2]], 69, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: [[SwapVXRMImm:%[0-9]+]]:gpr = SwapVXRMImm 2, implicit-def $vxrm, implicit $vxrm + ; CHECK-NEXT: [[PseudoVAADD_VV_MF8_:%[0-9]+]]:vr = PseudoVAADD_VV_MF8 [[COPY]], [[COPY1]], 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + ; CHECK-NEXT: WriteVXRM [[SwapVXRMImm]], implicit-def $vxrm + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: bb.1: + ; CHECK-NEXT: $v8 = COPY [[PseudoVAADD_VV_MF8_]] + ; CHECK-NEXT: PseudoRET implicit $v8 + bb.0.entry: + liveins: $v8, $v9, $x10 + + %0:vr = COPY $v8 + %1:vr = COPY $v9 + %2:gprnox0 = COPY $x10 + dead $x0 = PseudoVSETVLI %2:gprnox0, 69, implicit-def $vl, implicit-def $vtype + %3:vr = PseudoVAADD_VV_MF8 %0:vr, %1:vr, 2, $noreg, 3, implicit $vxrm, implicit $vl, implicit $vtype + bb.1: + $v8 = COPY %3:vr + PseudoRET implicit $v8 +... diff --git a/llvm/test/CodeGen/RISCV/rvv/vaadd-rm-rv64.ll b/llvm/test/CodeGen/RISCV/rvv/vaadd-rm-rv64.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vaadd-rm-rv64.ll @@ -0,0 +1,2250 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs \ +; RUN: < %s | FileCheck %s +declare @llvm.riscv.vaadd.rm.nxv1i8.nxv1i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv1i8_nxv1i8_nxv1i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv1i8_nxv1i8_nxv1i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i8.nxv1i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i8.nxv1i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv1i8_nxv1i8_nxv1i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv1i8_nxv1i8_nxv1i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i8.nxv1i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i8.nxv2i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv2i8_nxv2i8_nxv2i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv2i8_nxv2i8_nxv2i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i8.nxv2i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i8.nxv2i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv2i8_nxv2i8_nxv2i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv2i8_nxv2i8_nxv2i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i8.nxv2i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i8.nxv4i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv4i8_nxv4i8_nxv4i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv4i8_nxv4i8_nxv4i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i8.nxv4i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i8.nxv4i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv4i8_nxv4i8_nxv4i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv4i8_nxv4i8_nxv4i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i8.nxv4i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i8.nxv8i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv8i8_nxv8i8_nxv8i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv8i8_nxv8i8_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i8.nxv8i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i8.nxv8i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv8i8_nxv8i8_nxv8i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv8i8_nxv8i8_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i8.nxv8i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i8.nxv16i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv16i8_nxv16i8_nxv16i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv16i8_nxv16i8_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i8.nxv16i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i8.nxv16i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv16i8_nxv16i8_nxv16i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv16i8_nxv16i8_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i8.nxv16i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv32i8.nxv32i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv32i8_nxv32i8_nxv32i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv32i8_nxv32i8_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv32i8.nxv32i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv32i8.nxv32i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv32i8_nxv32i8_nxv32i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv32i8_nxv32i8_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv32i8.nxv32i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv64i8.nxv64i8( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv64i8_nxv64i8_nxv64i8( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv64i8_nxv64i8_nxv64i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv64i8.nxv64i8( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv64i8.nxv64i8( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv64i8_nxv64i8_nxv64i8( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv64i8_nxv64i8_nxv64i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vl8r.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv64i8.nxv64i8( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i16.nxv1i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv1i16_nxv1i16_nxv1i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv1i16_nxv1i16_nxv1i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i16.nxv1i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i16.nxv1i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv1i16_nxv1i16_nxv1i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv1i16_nxv1i16_nxv1i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i16.nxv1i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i16.nxv2i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv2i16_nxv2i16_nxv2i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv2i16_nxv2i16_nxv2i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i16.nxv2i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i16.nxv2i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv2i16_nxv2i16_nxv2i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv2i16_nxv2i16_nxv2i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i16.nxv2i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i16.nxv4i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv4i16_nxv4i16_nxv4i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv4i16_nxv4i16_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i16.nxv4i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i16.nxv4i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv4i16_nxv4i16_nxv4i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv4i16_nxv4i16_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i16.nxv4i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i16.nxv8i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv8i16_nxv8i16_nxv8i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv8i16_nxv8i16_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i16.nxv8i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i16.nxv8i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv8i16_nxv8i16_nxv8i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv8i16_nxv8i16_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i16.nxv8i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i16.nxv16i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv16i16_nxv16i16_nxv16i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv16i16_nxv16i16_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i16.nxv16i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i16.nxv16i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv16i16_nxv16i16_nxv16i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv16i16_nxv16i16_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i16.nxv16i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv32i16.nxv32i16( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv32i16_nxv32i16_nxv32i16( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv32i16_nxv32i16_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv32i16.nxv32i16( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv32i16.nxv32i16( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv32i16_nxv32i16_nxv32i16( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv32i16_nxv32i16_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vl8re16.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv32i16.nxv32i16( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i32.nxv1i32( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv1i32_nxv1i32_nxv1i32( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv1i32_nxv1i32_nxv1i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i32.nxv1i32( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i32.nxv1i32( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv1i32_nxv1i32_nxv1i32( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv1i32_nxv1i32_nxv1i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i32.nxv1i32( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i32.nxv2i32( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv2i32_nxv2i32_nxv2i32( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv2i32_nxv2i32_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i32.nxv2i32( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i32.nxv2i32( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv2i32_nxv2i32_nxv2i32( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv2i32_nxv2i32_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i32.nxv2i32( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i32.nxv4i32( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv4i32_nxv4i32_nxv4i32( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv4i32_nxv4i32_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i32.nxv4i32( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i32.nxv4i32( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv4i32_nxv4i32_nxv4i32( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv4i32_nxv4i32_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i32.nxv4i32( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i32.nxv8i32( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv8i32_nxv8i32_nxv8i32( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv8i32_nxv8i32_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i32.nxv8i32( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i32.nxv8i32( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv8i32_nxv8i32_nxv8i32( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv8i32_nxv8i32_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i32.nxv8i32( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i32.nxv16i32( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv16i32_nxv16i32_nxv16i32( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv16i32_nxv16i32_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i32.nxv16i32( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i32.nxv16i32( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv16i32_nxv16i32_nxv16i32( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv16i32_nxv16i32_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vl8re32.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i32.nxv16i32( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i64.nxv1i64( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv1i64_nxv1i64_nxv1i64( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv1i64_nxv1i64_nxv1i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v9 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i64.nxv1i64( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i64.nxv1i64( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv1i64_nxv1i64_nxv1i64( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv1i64_nxv1i64_nxv1i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, mu +; CHECK-NEXT: vaadd.vv v8, v9, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i64.nxv1i64( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i64.nxv2i64( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv2i64_nxv2i64_nxv2i64( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv2i64_nxv2i64_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i64.nxv2i64( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i64.nxv2i64( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv2i64_nxv2i64_nxv2i64( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv2i64_nxv2i64_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, mu +; CHECK-NEXT: vaadd.vv v8, v10, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i64.nxv2i64( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i64.nxv4i64( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv4i64_nxv4i64_nxv4i64( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv4i64_nxv4i64_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i64.nxv4i64( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i64.nxv4i64( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv4i64_nxv4i64_nxv4i64( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv4i64_nxv4i64_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, mu +; CHECK-NEXT: vaadd.vv v8, v12, v16, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i64.nxv4i64( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i64.nxv8i64( + , + , + , + i64, + i64); + +define @intrinsic_vaadd_vv_nxv8i64_nxv8i64_nxv8i64( %0, %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vv_nxv8i64_nxv8i64_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i64.nxv8i64( + undef, + %0, + %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i64.nxv8i64( + , + , + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vv_nxv8i64_nxv8i64_nxv8i64( %0, %1, %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vv_nxv8i64_nxv8i64_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vl8re64.v v24, (a0) +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vaadd.vv v8, v16, v24, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i64.nxv8i64( + %0, + %1, + %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv1i8_nxv1i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv1i8_nxv1i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv1i8_nxv1i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv1i8_nxv1i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv2i8_nxv2i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv2i8_nxv2i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv2i8_nxv2i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv2i8_nxv2i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv4i8_nxv4i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv4i8_nxv4i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv4i8_nxv4i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv4i8_nxv4i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv8i8_nxv8i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv8i8_nxv8i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv8i8_nxv8i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv8i8_nxv8i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv16i8_nxv16i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv16i8_nxv16i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv16i8_nxv16i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv16i8_nxv16i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv32i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv32i8_nxv32i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv32i8_nxv32i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv32i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv32i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv32i8_nxv32i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv32i8_nxv32i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv32i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv64i8.i8( + , + , + i8, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv64i8_nxv64i8_i8( %0, i8 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv64i8_nxv64i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv64i8.i8( + undef, + %0, + i8 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv64i8.i8( + , + , + i8, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv64i8_nxv64i8_i8( %0, %1, i8 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv64i8_nxv64i8_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv64i8.i8( + %0, + %1, + i8 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv1i16_nxv1i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv1i16_nxv1i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv1i16_nxv1i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv1i16_nxv1i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv2i16_nxv2i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv2i16_nxv2i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv2i16_nxv2i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv2i16_nxv2i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv4i16_nxv4i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv4i16_nxv4i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv4i16_nxv4i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv4i16_nxv4i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv8i16_nxv8i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv8i16_nxv8i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv8i16_nxv8i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv8i16_nxv8i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv16i16_nxv16i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv16i16_nxv16i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv16i16_nxv16i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv16i16_nxv16i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv32i16.i16( + , + , + i16, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv32i16_nxv32i16_i16( %0, i16 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv32i16_nxv32i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv32i16.i16( + undef, + %0, + i16 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv32i16.i16( + , + , + i16, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv32i16_nxv32i16_i16( %0, %1, i16 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv32i16_nxv32i16_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv32i16.i16( + %0, + %1, + i16 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i32.i32( + , + , + i32, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv1i32_nxv1i32_i32( %0, i32 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv1i32_nxv1i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i32.i32( + undef, + %0, + i32 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i32.i32( + , + , + i32, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv1i32_nxv1i32_i32( %0, %1, i32 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv1i32_nxv1i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i32.i32( + %0, + %1, + i32 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i32.i32( + , + , + i32, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv2i32_nxv2i32_i32( %0, i32 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv2i32_nxv2i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i32.i32( + undef, + %0, + i32 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i32.i32( + , + , + i32, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv2i32_nxv2i32_i32( %0, %1, i32 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv2i32_nxv2i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i32.i32( + %0, + %1, + i32 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i32.i32( + , + , + i32, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv4i32_nxv4i32_i32( %0, i32 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv4i32_nxv4i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i32.i32( + undef, + %0, + i32 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i32.i32( + , + , + i32, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv4i32_nxv4i32_i32( %0, %1, i32 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv4i32_nxv4i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i32.i32( + %0, + %1, + i32 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i32.i32( + , + , + i32, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv8i32_nxv8i32_i32( %0, i32 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv8i32_nxv8i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i32.i32( + undef, + %0, + i32 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i32.i32( + , + , + i32, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv8i32_nxv8i32_i32( %0, %1, i32 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv8i32_nxv8i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i32.i32( + %0, + %1, + i32 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv16i32.i32( + , + , + i32, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv16i32_nxv16i32_i32( %0, i32 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv16i32_nxv16i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv16i32.i32( + undef, + %0, + i32 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv16i32.i32( + , + , + i32, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv16i32_nxv16i32_i32( %0, %1, i32 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv16i32_nxv16i32_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv16i32.i32( + %0, + %1, + i32 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv1i64.i64( + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv1i64_nxv1i64_i64( %0, i64 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv1i64_nxv1i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv1i64.i64( + undef, + %0, + i64 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv1i64.i64( + , + , + i64, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv1i64_nxv1i64_i64( %0, %1, i64 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv1i64_nxv1i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m1, ta, mu +; CHECK-NEXT: vaadd.vx v8, v9, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv1i64.i64( + %0, + %1, + i64 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv2i64.i64( + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv2i64_nxv2i64_i64( %0, i64 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv2i64_nxv2i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv2i64.i64( + undef, + %0, + i64 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv2i64.i64( + , + , + i64, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv2i64_nxv2i64_i64( %0, %1, i64 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv2i64_nxv2i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m2, ta, mu +; CHECK-NEXT: vaadd.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv2i64.i64( + %0, + %1, + i64 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv4i64.i64( + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv4i64_nxv4i64_i64( %0, i64 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv4i64_nxv4i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv4i64.i64( + undef, + %0, + i64 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv4i64.i64( + , + , + i64, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv4i64_nxv4i64_i64( %0, %1, i64 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv4i64_nxv4i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m4, ta, mu +; CHECK-NEXT: vaadd.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv4i64.i64( + %0, + %1, + i64 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.nxv8i64.i64( + , + , + i64, + i64, + i64); + +define @intrinsic_vaadd_vx_nxv8i64_nxv8i64_i64( %0, i64 %1, i64 %2) nounwind { +; CHECK-LABEL: intrinsic_vaadd_vx_nxv8i64_nxv8i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v8, a0 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.nxv8i64.i64( + undef, + %0, + i64 %1, + i64 %2, + i64 4) + + ret %a +} + +declare @llvm.riscv.vaadd.rm.mask.nxv8i64.i64( + , + , + i64, + , + i64, + i64, + i64); + +define @intrinsic_vaadd_mask_vx_nxv8i64_nxv8i64_i64( %0, %1, i64 %2, %3, i64 %4) nounwind { +; CHECK-LABEL: intrinsic_vaadd_mask_vx_nxv8i64_nxv8i64_i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, mu +; CHECK-NEXT: vaadd.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.vaadd.rm.mask.nxv8i64.i64( + %0, + %1, + i64 %2, + %3, + i64 %4, i64 1, + i64 4) + + ret %a +}