LLVM 22.0.0git
LoongArchISelLowering.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loongarch-isel-lowering"
#define IOCSRRD_CASE(NAME, NODE)
#define IOCSRWR_CASE(NAME, NODE)
#define ASRT_LE_GT_CASE(NAME)
#define CRC_CASE_EXT_BINARYOP(NAME, NODE)
#define CRC_CASE_EXT_UNARYOP(NAME, NODE)
#define CSR_CASE(ID)
#define IOCSRRD_CASE(NAME, NODE)
#define NODE_NAME_CASE(node)
#define GET_REGISTER_MATCHER

Functions

 STATISTIC (NumTailCalls, "Number of tail calls")
static std::optional< boolmatchSetCC (SDValue LHS, SDValue RHS, ISD::CondCode CC, SDValue Val)
static SDValue combineSelectToBinOp (SDNode *N, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
static SDValue foldBinOpIntoSelectIfProfitable (SDNode *BO, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
static void translateSetCCForBranch (const SDLoc &DL, SDValue &LHS, SDValue &RHS, ISD::CondCode &CC, SelectionDAG &DAG)
static SDValue widenShuffleMask (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
static int matchShuffleAsShift (MVT &ShiftVT, unsigned &Opcode, unsigned ScalarSizeInBits, ArrayRef< int > Mask, int MaskOffset, const APInt &Zeroable)
 Attempts to match a shuffle mask against the VBSLL, VBSRL, VSLLI and VSRLI instruction.
static SDValue lowerVECTOR_SHUFFLEAsShift (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget, const APInt &Zeroable)
 Lower VECTOR_SHUFFLE as shift (if possible).
template<typename ValType>
static bool fitsRegularPattern (typename SmallVectorImpl< ValType >::const_iterator Begin, unsigned CheckStride, typename SmallVectorImpl< ValType >::const_iterator End, ValType ExpectedIndex, unsigned ExpectedIndexStride)
 Determine whether a range fits a regular pattern of values.
static void computeZeroableShuffleElements (ArrayRef< int > Mask, SDValue V1, SDValue V2, APInt &KnownUndef, APInt &KnownZero)
 Compute whether each element of a shuffle is zeroable.
static bool isRepeatedShuffleMask (unsigned LaneSizeInBits, MVT VT, ArrayRef< int > Mask, SmallVectorImpl< int > &RepeatedMask)
 Test whether a shuffle mask is equivalent within each sub-lane.
static int matchShuffleAsByteRotate (MVT VT, SDValue &V1, SDValue &V2, ArrayRef< int > Mask)
 Attempts to match vector shuffle as byte rotation.
static SDValue lowerVECTOR_SHUFFLEAsByteRotate (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Lower VECTOR_SHUFFLE as byte rotate (if possible).
static SDValue lowerVECTOR_SHUFFLEAsZeroOrAnyExtend (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const APInt &Zeroable)
 Lower VECTOR_SHUFFLE as ZERO_EXTEND Or ANY_EXTEND (if possible).
static SDValue lowerVECTOR_SHUFFLE_VREPLVEI (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Lower VECTOR_SHUFFLE into VREPLVEI (if possible).
static SDValue lowerVECTOR_SHUFFLE_VSHUF4I (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Lower VECTOR_SHUFFLE into VSHUF4I (if possible).
static SDValue lowerVECTOR_SHUFFLE_VPACKEV (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VPACKEV (if possible).
static SDValue lowerVECTOR_SHUFFLE_VPACKOD (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VPACKOD (if possible).
static SDValue lowerVECTOR_SHUFFLE_VILVH (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VILVH (if possible).
static SDValue lowerVECTOR_SHUFFLE_VILVL (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VILVL (if possible).
static SDValue lowerVECTOR_SHUFFLE_VPICKEV (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VPICKEV (if possible).
static SDValue lowerVECTOR_SHUFFLE_VPICKOD (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VPICKOD (if possible).
static SDValue lowerVECTOR_SHUFFLE_VSHUF (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into VSHUF.
static SDValue lower128BitShuffle (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Dispatching routine to lower various 128-bit LoongArch vector shuffles.
static SDValue lowerVECTOR_SHUFFLE_XVREPLVEI (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Lower VECTOR_SHUFFLE into XVREPLVEI (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVSHUF4I (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Lower VECTOR_SHUFFLE into XVSHUF4I (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVPERM (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVPERM (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVPACKEV (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVPACKEV (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVPACKOD (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVPACKOD (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVILVH (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVILVH (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVILVL (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVILVL (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVPICKEV (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVPICKEV (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVPICKOD (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVPICKOD (if possible).
static SDValue lowerVECTOR_SHUFFLE_XVSHUF (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE into XVSHUF (if possible).
static void canonicalizeShuffleVectorByLane (const SDLoc &DL, MutableArrayRef< int > Mask, MVT VT, SDValue &V1, SDValue &V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Shuffle vectors by lane to generate more optimized instructions.
static SDValue lowerVECTOR_SHUFFLEAsLanePermuteAndShuffle (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG)
 Lower VECTOR_SHUFFLE as lane permute and then shuffle (if possible).
static SDValue lower256BitShuffle (const SDLoc &DL, ArrayRef< int > Mask, MVT VT, SDValue V1, SDValue V2, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
 Dispatching routine to lower various 256-bit LoongArch vector shuffles.
static SDValue lowerBUILD_VECTORAsBroadCastLoad (BuildVectorSDNode *BVOp, const SDLoc &DL, SelectionDAG &DAG)
static SDValue getTargetNode (GlobalAddressSDNode *N, SDLoc DL, EVT Ty, SelectionDAG &DAG, unsigned Flags)
static SDValue getTargetNode (BlockAddressSDNode *N, SDLoc DL, EVT Ty, SelectionDAG &DAG, unsigned Flags)
static SDValue getTargetNode (ConstantPoolSDNode *N, SDLoc DL, EVT Ty, SelectionDAG &DAG, unsigned Flags)
static SDValue getTargetNode (JumpTableSDNode *N, SDLoc DL, EVT Ty, SelectionDAG &DAG, unsigned Flags)
template<unsigned N>
static SDValue checkIntrinsicImmArg (SDValue Op, unsigned ImmOp, SelectionDAG &DAG, bool IsSigned=false)
static SDValue emitIntrinsicWithChainErrorMessage (SDValue Op, StringRef ErrorMsg, SelectionDAG &DAG)
static SDValue emitIntrinsicErrorMessage (SDValue Op, StringRef ErrorMsg, SelectionDAG &DAG)
static LoongArchISD::NodeType getLoongArchWOpcode (unsigned Opcode)
static SDValue customLegalizeToWOp (SDNode *N, SelectionDAG &DAG, int NumOp, unsigned ExtOpc=ISD::ANY_EXTEND)
static SDValue customLegalizeToWOpWithSExt (SDNode *N, SelectionDAG &DAG)
static void emitErrorAndReplaceIntrinsicResults (SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, StringRef ErrorMsg, bool WithChain=true)
template<unsigned N>
static void replaceVPICKVE2GRResults (SDNode *Node, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget, unsigned ResOp)
static void replaceVecCondBranchResults (SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget, unsigned ResOp)
static void replaceINTRINSIC_WO_CHAINResults (SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
static void replaceCMP_XCHG_128Results (SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG)
static SDValue performANDCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performSRLCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static bool checkBitcastSrcVectorSize (SDValue Src, unsigned Size, unsigned Depth)
static SDValue signExtendBitcastSrcVector (SelectionDAG &DAG, EVT SExtVT, SDValue Src, const SDLoc &DL)
static SDValue performSETCC_BITCASTCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performBITCASTCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performORCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static bool checkValueWidth (SDValue V, ISD::LoadExtType &ExtType)
static SDValue performSETCCCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performBITREV_WCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static bool combine_CC (SDValue &LHS, SDValue &RHS, SDValue &CC, const SDLoc &DL, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget)
static SDValue performBR_CCCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performSELECT_CCCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
template<unsigned N>
static SDValue legalizeIntrinsicImmArg (SDNode *Node, unsigned ImmOp, SelectionDAG &DAG, const LoongArchSubtarget &Subtarget, bool IsSigned=false)
template<unsigned N>
static SDValue lowerVectorSplatImm (SDNode *Node, unsigned ImmOp, SelectionDAG &DAG, bool IsSigned=false)
static SDValue truncateVecElts (SDNode *Node, SelectionDAG &DAG)
static SDValue lowerVectorBitClear (SDNode *Node, SelectionDAG &DAG)
template<unsigned N>
static SDValue lowerVectorBitClearImm (SDNode *Node, SelectionDAG &DAG)
template<unsigned N>
static SDValue lowerVectorBitSetImm (SDNode *Node, SelectionDAG &DAG)
template<unsigned N>
static SDValue lowerVectorBitRevImm (SDNode *Node, SelectionDAG &DAG)
static SDValue performINTRINSIC_WO_CHAINCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performMOVGR2FR_WCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performMOVFR2GR_SCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performVMSKLTZCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performSPLIT_PAIR_F64Combine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static SDValue performEXTRACT_VECTOR_ELTCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockinsertDivByZeroTrap (MachineInstr &MI, MachineBasicBlock *MBB)
static MachineBasicBlockemitVecCondBranchPseudo (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockemitPseudoXVINSGR2VR (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockemitPseudoCTPOP (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockemitPseudoVMSKCOND (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockemitSplitPairF64Pseudo (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static MachineBasicBlockemitBuildPairF64Pseudo (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static bool isSelectPseudo (MachineInstr &MI)
static MachineBasicBlockemitSelectPseudo (MachineInstr &MI, MachineBasicBlock *BB, const LoongArchSubtarget &Subtarget)
static bool CC_LoongArchAssign2GRLen (unsigned GRLen, CCState &State, CCValAssign VA1, ISD::ArgFlagsTy ArgFlags1, unsigned ValNo2, MVT ValVT2, MVT LocVT2, ISD::ArgFlagsTy ArgFlags2)
static bool CC_LoongArch (const DataLayout &DL, LoongArchABI::ABI ABI, unsigned ValNo, MVT ValVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, bool IsRet, Type *OrigTy)
static SDValue convertLocVTToValVT (SelectionDAG &DAG, SDValue Val, const CCValAssign &VA, const SDLoc &DL)
static SDValue unpackFromRegLoc (SelectionDAG &DAG, SDValue Chain, const CCValAssign &VA, const SDLoc &DL, const ISD::InputArg &In, const LoongArchTargetLowering &TLI)
static SDValue unpackFromMemLoc (SelectionDAG &DAG, SDValue Chain, const CCValAssign &VA, const SDLoc &DL)
static SDValue unpackF64OnLA32DSoftABI (SelectionDAG &DAG, SDValue Chain, const CCValAssign &VA, const CCValAssign &HiVA, const SDLoc &DL)
static SDValue convertValVTToLocVT (SelectionDAG &DAG, SDValue Val, const CCValAssign &VA, const SDLoc &DL)
static bool CC_LoongArch_GHC (unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static Align getPrefTypeAlign (EVT VT, SelectionDAG &DAG)
static Intrinsic::ID getIntrinsicForMaskedAtomicRMWBinOp (unsigned GRLen, AtomicRMWInst::BinOp BinOp)
static int getEstimateRefinementSteps (EVT VT, const LoongArchSubtarget &Subtarget)

Variables

static cl::opt< boolZeroDivCheck ("loongarch-check-zero-division", cl::Hidden, cl::desc("Trap on integer division by zero."), cl::init(false))
const MCPhysReg ArgGPRs []
const MCPhysReg ArgFPR32s []
const MCPhysReg ArgFPR64s []
const MCPhysReg ArgVRs []
const MCPhysReg ArgXRs []

Macro Definition Documentation

◆ ASRT_LE_GT_CASE

#define ASRT_LE_GT_CASE ( NAME)
Value:
case Intrinsic::loongarch_##NAME: { \
return !Subtarget.is64Bit() \
? emitIntrinsicErrorMessage(Op, ErrorMsgReqLA64, DAG) \
: Op; \
}
static SDValue emitIntrinsicErrorMessage(SDValue Op, StringRef ErrorMsg, SelectionDAG &DAG)
DWARFExpression::Operation Op

◆ CRC_CASE_EXT_BINARYOP

#define CRC_CASE_EXT_BINARYOP ( NAME,
NODE )
Value:
case Intrinsic::loongarch_##NAME: { \
SDValue NODE = DAG.getNode( \
LoongArchISD::NODE, DL, {MVT::i64, MVT::Other}, \
{Chain, DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op2), \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, N->getOperand(3))}); \
Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, VT, NODE.getValue(0))); \
Results.push_back(NODE.getValue(1)); \
break; \
}
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
#define NODE(NodeKind)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
@ ANY_EXTEND
ANY_EXTEND - Used for integer types. The high bits are undefined.
Definition ISDOpcodes.h:835
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
Definition ISDOpcodes.h:838
#define N

Referenced by llvm::LoongArchTargetLowering::ReplaceNodeResults().

◆ CRC_CASE_EXT_UNARYOP

#define CRC_CASE_EXT_UNARYOP ( NAME,
NODE )
Value:
case Intrinsic::loongarch_##NAME: { \
SDValue NODE = DAG.getNode( \
LoongArchISD::NODE, DL, {MVT::i64, MVT::Other}, \
{Chain, Op2, \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, N->getOperand(3))}); \
Results.push_back(DAG.getNode(ISD::TRUNCATE, DL, VT, NODE.getValue(0))); \
Results.push_back(NODE.getValue(1)); \
break; \
}

Referenced by llvm::LoongArchTargetLowering::ReplaceNodeResults().

◆ CSR_CASE

#define CSR_CASE ( ID)
Value:
case Intrinsic::loongarch_##ID: { \
if (!Subtarget.is64Bit()) \
emitErrorAndReplaceIntrinsicResults(N, Results, DAG, ErrorMsgReqLA64); \
break; \
}
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24

Referenced by llvm::LoongArchTargetLowering::ReplaceNodeResults().

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loongarch-isel-lowering"

Definition at line 40 of file LoongArchISelLowering.cpp.

◆ GET_REGISTER_MATCHER

#define GET_REGISTER_MATCHER

Definition at line 8792 of file LoongArchISelLowering.cpp.

◆ IOCSRRD_CASE [1/2]

#define IOCSRRD_CASE ( NAME,
NODE )
Value:
case Intrinsic::loongarch_##NAME: { \
return DAG.getNode(LoongArchISD::NODE, DL, {GRLenVT, MVT::Other}, \
{Chain, Op.getOperand(2)}); \
}

Referenced by llvm::LoongArchTargetLowering::ReplaceNodeResults().

◆ IOCSRRD_CASE [2/2]

#define IOCSRRD_CASE ( NAME,
NODE )
Value:
case Intrinsic::loongarch_##NAME: { \
SDValue IOCSRRDResults = \
DAG.getNode(LoongArchISD::NODE, DL, {MVT::i64, MVT::Other}, \
{Chain, DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op2)}); \
Results.push_back( \
DAG.getNode(ISD::TRUNCATE, DL, VT, IOCSRRDResults.getValue(0))); \
Results.push_back(IOCSRRDResults.getValue(1)); \
break; \
}
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const

◆ IOCSRWR_CASE

#define IOCSRWR_CASE ( NAME,
NODE )
Value:
case Intrinsic::loongarch_##NAME: { \
SDValue Op3 = Op.getOperand(3); \
return Subtarget.is64Bit() \
? DAG.getNode(LoongArchISD::NODE, DL, MVT::Other, Chain, \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op2), \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op3)) \
: DAG.getNode(LoongArchISD::NODE, DL, MVT::Other, Chain, Op2, \
Op3); \
}

◆ NODE_NAME_CASE

#define NODE_NAME_CASE ( node)
Value:
case LoongArchISD::node: \
return "LoongArchISD::" #node;

Function Documentation

◆ canonicalizeShuffleVectorByLane()

void canonicalizeShuffleVectorByLane ( const SDLoc & DL,
MutableArrayRef< int > Mask,
MVT VT,
SDValue & V1,
SDValue & V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Shuffle vectors by lane to generate more optimized instructions.

256-bit shuffles are always considered as 2-lane 128-bit shuffles.

Therefore, except for the following four cases, other cases are regarded as cross-lane shuffles, where optimization is relatively limited.

  • Shuffle high, low lanes of two inputs vector <0, 1, 2, 3> + <4, 5, 6, 7> — <0, 5, 3, 6>
  • Shuffle low, high lanes of two inputs vector <0, 1, 2, 3> + <4, 5, 6, 7> — <3, 6, 0, 5>
  • Shuffle low, low lanes of two inputs vector <0, 1, 2, 3> + <4, 5, 6, 7> — <3, 6, 3, 6>
  • Shuffle high, high lanes of two inputs vector <0, 1, 2, 3> + <4, 5, 6, 7> — <0, 5, 0, 5>

The first case is the closest to LoongArch instructions and the other cases need to be converted to it for processing.

This function may modify V1, V2 and Mask

Definition at line 2270 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), llvm::SDValue::isUndef(), llvm::None, and llvm::LoongArchISD::XVPERMI.

Referenced by lower256BitShuffle().

◆ CC_LoongArch()

bool CC_LoongArch ( const DataLayout & DL,
LoongArchABI::ABI ABI,
unsigned ValNo,
MVT ValVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags,
CCState & State,
bool IsRet,
Type * OrigTy )
static

◆ CC_LoongArch_GHC()

bool CC_LoongArch_GHC ( unsigned ValNo,
MVT ValVT,
MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags,
Type * OrigTy,
CCState & State )
static

◆ CC_LoongArchAssign2GRLen()

◆ checkBitcastSrcVectorSize()

◆ checkIntrinsicImmArg()

◆ checkValueWidth()

◆ combine_CC()

◆ combineSelectToBinOp()

◆ computeZeroableShuffleElements()

void computeZeroableShuffleElements ( ArrayRef< int > Mask,
SDValue V1,
SDValue V2,
APInt & KnownUndef,
APInt & KnownZero )
static

Compute whether each element of a shuffle is zeroable.

A "zeroable" vector shuffle element is one which can be lowered to zero.

Definition at line 1244 of file LoongArchISelLowering.cpp.

References assert(), llvm::SDValue::getNode(), llvm::SDValue::getValueSizeInBits(), llvm::APInt::getZero(), llvm::ISD::isBuildVectorAllZeros(), llvm::peekThroughBitcasts(), llvm::APInt::setBit(), and Size.

Referenced by lower128BitShuffle(), lower256BitShuffle(), and lowerVECTOR_SHUFFLE().

◆ convertLocVTToValVT()

◆ convertValVTToLocVT()

◆ customLegalizeToWOp()

◆ customLegalizeToWOpWithSExt()

◆ emitBuildPairF64Pseudo()

◆ emitErrorAndReplaceIntrinsicResults()

void emitErrorAndReplaceIntrinsicResults ( SDNode * N,
SmallVectorImpl< SDValue > & Results,
SelectionDAG & DAG,
StringRef ErrorMsg,
bool WithChain = true )
static

◆ emitIntrinsicErrorMessage()

SDValue emitIntrinsicErrorMessage ( SDValue Op,
StringRef ErrorMsg,
SelectionDAG & DAG )
static

◆ emitIntrinsicWithChainErrorMessage()

◆ emitPseudoCTPOP()

◆ emitPseudoVMSKCOND()

◆ emitPseudoXVINSGR2VR()

◆ emitSelectPseudo()

◆ emitSplitPairF64Pseudo()

◆ emitVecCondBranchPseudo()

◆ fitsRegularPattern()

◆ foldBinOpIntoSelectIfProfitable()

◆ getEstimateRefinementSteps()

int getEstimateRefinementSteps ( EVT VT,
const LoongArchSubtarget & Subtarget )
static

◆ getIntrinsicForMaskedAtomicRMWBinOp()

◆ getLoongArchWOpcode()

◆ getPrefTypeAlign()

◆ getTargetNode() [1/4]

SDValue getTargetNode ( BlockAddressSDNode * N,
SDLoc DL,
EVT Ty,
SelectionDAG & DAG,
unsigned Flags )
static

Definition at line 3142 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getTargetBlockAddress(), and N.

◆ getTargetNode() [2/4]

SDValue getTargetNode ( ConstantPoolSDNode * N,
SDLoc DL,
EVT Ty,
SelectionDAG & DAG,
unsigned Flags )
static

Definition at line 3148 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getTargetConstantPool(), and N.

◆ getTargetNode() [3/4]

SDValue getTargetNode ( GlobalAddressSDNode * N,
SDLoc DL,
EVT Ty,
SelectionDAG & DAG,
unsigned Flags )
static

Definition at line 3137 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getTargetGlobalAddress(), and N.

◆ getTargetNode() [4/4]

SDValue getTargetNode ( JumpTableSDNode * N,
SDLoc DL,
EVT Ty,
SelectionDAG & DAG,
unsigned Flags )
static

Definition at line 3154 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getTargetJumpTable(), and N.

◆ insertDivByZeroTrap()

◆ isRepeatedShuffleMask()

bool isRepeatedShuffleMask ( unsigned LaneSizeInBits,
MVT VT,
ArrayRef< int > Mask,
SmallVectorImpl< int > & RepeatedMask )
static

Test whether a shuffle mask is equivalent within each sub-lane.

The specific repeated shuffle mask is populated in RepeatedMask, as it is non-trivial to compute in the face of undef lanes. The representation is suitable for use with existing 128-bit shuffles as entries from the second vector have been remapped to [LaneSize, 2*LaneSize).

Definition at line 1280 of file LoongArchISelLowering.cpp.

References assert(), llvm::SmallVectorImpl< T >::assign(), llvm::MVT::getScalarSizeInBits(), and Size.

Referenced by is128BitLaneRepeatedShuffleMask(), is128BitLaneRepeatedShuffleMask(), is256BitLaneRepeatedShuffleMask(), and matchShuffleAsByteRotate().

◆ isSelectPseudo()

bool isSelectPseudo ( MachineInstr & MI)
static

Definition at line 6776 of file LoongArchISelLowering.cpp.

References MI.

Referenced by emitSelectPseudo().

◆ legalizeIntrinsicImmArg()

◆ lower128BitShuffle()

◆ lower256BitShuffle()

◆ lowerBUILD_VECTORAsBroadCastLoad()

◆ lowerVECTOR_SHUFFLE_VILVH()

SDValue lowerVECTOR_SHUFFLE_VILVH ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VILVH (if possible).

VILVH interleaves consecutive elements from the left (highest-indexed) half of each vector.

It is possible to lower into VILVH when the mask consists of two of the following forms interleaved: <x, x+1, x+2, ...> <n+x, n+x+1, n+x+2, ...> where n is the number of elements in the vector and x is half n. For example: <x, x, x+1, x+1, x+2, x+2, ...> <x, n+x, x+1, n+x+1, x+2, n+x+2, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1704 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VILVH.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VILVL()

SDValue lowerVECTOR_SHUFFLE_VILVL ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VILVL (if possible).

VILVL interleaves consecutive elements from the right (lowest-indexed) half of each vector.

It is possible to lower into VILVL when the mask consists of two of the following forms interleaved: <0, 1, 2, ...> <n, n+1, n+2, ...> where n is the number of elements in the vector. For example: <0, 0, 1, 1, 2, 2, ...> <0, n, 1, n+1, 2, n+2, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1747 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VILVL.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VPACKEV()

SDValue lowerVECTOR_SHUFFLE_VPACKEV ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VPACKEV (if possible).

VPACKEV interleaves the even elements from each vector.

It is possible to lower into VPACKEV when the mask consists of two of the following forms interleaved: <0, 2, 4, ...> <n, n+2, n+4, ...> where n is the number of elements in the vector. For example: <0, 0, 2, 2, 4, 4, ...> <0, n, 2, n+2, 4, n+4, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1623 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPACKEV.

Referenced by lower128BitShuffle(), and lowerVECTOR_SHUFFLE_XVPACKEV().

◆ lowerVECTOR_SHUFFLE_VPACKOD()

SDValue lowerVECTOR_SHUFFLE_VPACKOD ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VPACKOD (if possible).

VPACKOD interleaves the odd elements from each vector.

It is possible to lower into VPACKOD when the mask consists of two of the following forms interleaved: <1, 3, 5, ...> <n+1, n+3, n+5, ...> where n is the number of elements in the vector. For example: <1, 1, 3, 3, 5, 5, ...> <1, n+1, 3, n+3, 5, n+5, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1663 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPACKOD.

Referenced by lower128BitShuffle(), and lowerVECTOR_SHUFFLE_XVPACKOD().

◆ lowerVECTOR_SHUFFLE_VPICKEV()

SDValue lowerVECTOR_SHUFFLE_VPICKEV ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VPICKEV (if possible).

VPICKEV copies the even elements of each vector into the result vector.

It is possible to lower into VPICKEV when the mask consists of two of the following forms concatenated: <0, 2, 4, ...> <n, n+2, n+4, ...> where n is the number of elements in the vector. For example: <0, 2, 4, ..., 0, 2, 4, ...> <0, 2, 4, ..., n, n+2, n+4, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1787 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPICKEV.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VPICKOD()

SDValue lowerVECTOR_SHUFFLE_VPICKOD ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VPICKOD (if possible).

VPICKOD copies the odd elements of each vector into the result vector.

It is possible to lower into VPICKOD when the mask consists of two of the following forms concatenated: <1, 3, 5, ...> <n+1, n+3, n+5, ...> where n is the number of elements in the vector. For example: <1, 3, 5, ..., 1, 3, 5, ...> <1, 3, 5, ..., n+1, n+3, n+5, ...>

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above forms.

Definition at line 1829 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPICKOD.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VREPLVEI()

SDValue lowerVECTOR_SHUFFLE_VREPLVEI ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Lower VECTOR_SHUFFLE into VREPLVEI (if possible).

VREPLVEI performs vector broadcast based on an element specified by an integer immediate, with its mask being similar to: <x, x, x, ...> where x is any valid index.

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above form.

Definition at line 1510 of file LoongArchISelLowering.cpp.

References assert(), DL, fitsRegularPattern(), llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getUNDEF(), SDValue(), and llvm::LoongArchISD::VREPLVEI.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VSHUF()

SDValue lowerVECTOR_SHUFFLE_VSHUF ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into VSHUF.

This mostly consists of converting the shuffle mask into a BUILD_VECTOR and adding it as an operand to the resulting VSHUF.

Definition at line 1859 of file LoongArchISelLowering.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::MVT::changeVectorElementTypeToInteger(), DL, llvm::SelectionDAG::getBuildVector(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getNode(), and llvm::LoongArchISD::VSHUF.

Referenced by lower128BitShuffle().

◆ lowerVECTOR_SHUFFLE_VSHUF4I()

SDValue lowerVECTOR_SHUFFLE_VSHUF4I ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Lower VECTOR_SHUFFLE into VSHUF4I (if possible).

VSHUF4I splits the vector into blocks of four elements, then shuffles these elements according to a <4 x i2> constant (encoded as an integer immediate).

It is therefore possible to lower into VSHUF4I when the mask takes the form: <a, b, c, d, a+4, b+4, c+4, d+4, a+8, b+8, c+8, d+8, ...> When undef's appear they are treated as if they were whatever value is necessary in order to fit the above forms.

For example: %2 = shufflevector <8 x i16> %0, <8 x i16> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4> is lowered to: (VSHUF4I_H $v0, $v1, 27) where the 27 comes from: 3 + (2 << 2) + (1 << 4) + (0 << 6)

Definition at line 1553 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VSHUF4I.

Referenced by lower128BitShuffle(), and lowerVECTOR_SHUFFLE_XVSHUF4I().

◆ lowerVECTOR_SHUFFLE_XVILVH()

SDValue lowerVECTOR_SHUFFLE_XVILVH ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVILVH (if possible).

Definition at line 2058 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VILVH.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVILVL()

SDValue lowerVECTOR_SHUFFLE_XVILVL ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVILVL (if possible).

Definition at line 2097 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VILVL.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVPACKEV()

SDValue lowerVECTOR_SHUFFLE_XVPACKEV ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVPACKEV (if possible).

Definition at line 2044 of file LoongArchISelLowering.cpp.

References DL, and lowerVECTOR_SHUFFLE_VPACKEV().

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVPACKOD()

SDValue lowerVECTOR_SHUFFLE_XVPACKOD ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVPACKOD (if possible).

Definition at line 2051 of file LoongArchISelLowering.cpp.

References DL, and lowerVECTOR_SHUFFLE_VPACKOD().

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVPERM()

◆ lowerVECTOR_SHUFFLE_XVPICKEV()

SDValue lowerVECTOR_SHUFFLE_XVPICKEV ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVPICKEV (if possible).

Definition at line 2131 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPICKEV.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVPICKOD()

SDValue lowerVECTOR_SHUFFLE_XVPICKOD ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE into XVPICKOD (if possible).

Definition at line 2166 of file LoongArchISelLowering.cpp.

References DL, fitsRegularPattern(), llvm::SelectionDAG::getNode(), SDValue(), and llvm::LoongArchISD::VPICKOD.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVREPLVEI()

SDValue lowerVECTOR_SHUFFLE_XVREPLVEI ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Lower VECTOR_SHUFFLE into XVREPLVEI (if possible).

It is a XVREPLVEI when the mask is: <x, x, x, ..., x+n, x+n, x+n, ...> where the number of x is equal to n and n is half the length of vector.

When undef's appear in the mask they are treated as if they were whatever value is necessary in order to fit the above form.

Definition at line 1959 of file LoongArchISelLowering.cpp.

References assert(), DL, fitsRegularPattern(), llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), llvm::SelectionDAG::getUNDEF(), SDValue(), and llvm::LoongArchISD::VREPLVEI.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLE_XVSHUF()

◆ lowerVECTOR_SHUFFLE_XVSHUF4I()

SDValue lowerVECTOR_SHUFFLE_XVSHUF4I ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Lower VECTOR_SHUFFLE into XVSHUF4I (if possible).

Definition at line 1991 of file LoongArchISelLowering.cpp.

References DL, lowerVECTOR_SHUFFLE_VSHUF4I(), and SDValue().

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLEAsByteRotate()

SDValue lowerVECTOR_SHUFFLEAsByteRotate ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget )
static

Lower VECTOR_SHUFFLE as byte rotate (if possible).

For example: shuffle = shufflevector <2 x i64> a, <2 x i64> b, <2 x i32> <i32 3, i32 0> is lowered to: (VBSRL_V $v1, $v1, 8) (VBSLL_V $v0, $v0, 8) (VOR_V $v0, $V0, $v1)

Definition at line 1384 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), llvm::MVT::getSizeInBits(), llvm::MVT::getVectorVT(), llvm::Hi, llvm::Lo, matchShuffleAsByteRotate(), llvm::ISD::OR, SDValue(), llvm::LoongArchISD::VBSLL, and llvm::LoongArchISD::VBSRL.

Referenced by lower128BitShuffle(), and lower256BitShuffle().

◆ lowerVECTOR_SHUFFLEAsLanePermuteAndShuffle()

SDValue lowerVECTOR_SHUFFLEAsLanePermuteAndShuffle ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG )
static

Lower VECTOR_SHUFFLE as lane permute and then shuffle (if possible).

Only for 256-bit vector.

For example: %2 = shufflevector <4 x i64> %0, <4 x i64> posion, <4 x i64> <i32 0, i32 3, i32 2, i32 0> is lowerded to: (XVPERMI $xr2, $xr0, 78) (XVSHUF $xr1, $xr2, $xr0) (XVORI $xr0, $xr1, 0)

Definition at line 2379 of file LoongArchISelLowering.cpp.

References assert(), llvm::SmallVectorImpl< T >::assign(), DL, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getUNDEF(), llvm::SelectionDAG::getVectorShuffle(), llvm::MVT::is256BitVector(), SDValue(), and Size.

Referenced by lower256BitShuffle().

◆ lowerVECTOR_SHUFFLEAsShift()

SDValue lowerVECTOR_SHUFFLEAsShift ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget,
const APInt & Zeroable )
static

Lower VECTOR_SHUFFLE as shift (if possible).

For example: %2 = shufflevector <4 x i32> %0, <4 x i32> zeroinitializer, <4 x i32> <i32 4, i32 0, i32 1, i32 2> is lowered to: (VBSLL_V $v0, $v0, 4)

%2 = shufflevector <4 x i32> %0, <4 x i32> zeroinitializer, <4 x i32> <i32 4, i32 0, i32 4, i32 2> is lowered to: (VSLLI_D $v0, $v0, 32)

Definition at line 1184 of file LoongArchISelLowering.cpp.

References assert(), DL, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getConstant(), llvm::LoongArchSubtarget::getGRLenVT(), llvm::SelectionDAG::getNode(), llvm::MVT::getScalarSizeInBits(), llvm::SelectionDAG::getTargetLoweringInfo(), llvm::MVT::getVectorNumElements(), llvm::TargetLoweringBase::isTypeLegal(), matchShuffleAsShift(), SDValue(), and Size.

Referenced by lower128BitShuffle(), and lower256BitShuffle().

◆ lowerVECTOR_SHUFFLEAsZeroOrAnyExtend()

SDValue lowerVECTOR_SHUFFLEAsZeroOrAnyExtend ( const SDLoc & DL,
ArrayRef< int > Mask,
MVT VT,
SDValue V1,
SDValue V2,
SelectionDAG & DAG,
const APInt & Zeroable )
static

Lower VECTOR_SHUFFLE as ZERO_EXTEND Or ANY_EXTEND (if possible).

For example: %2 = shufflevector <4 x i32> %0, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 4, i32 1, i32 4> %3 = bitcast <4 x i32> %2 to <2 x i64> is lowered to: (VREPLI $v1, 0) (VILVL $v0, $v1, $v0)

Definition at line 1417 of file LoongArchISelLowering.cpp.

References DL, llvm::SelectionDAG::getBitcast(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getFreeze(), llvm::MVT::getIntegerVT(), llvm::SelectionDAG::getNode(), llvm::MVT::getScalarSizeInBits(), llvm::MVT::getSizeInBits(), llvm::MVT::getVectorNumElements(), llvm::MVT::getVectorVT(), llvm::APInt::isAllOnes(), llvm::Lower, llvm::Offset, SDValue(), llvm::LoongArchISD::VILVH, and llvm::LoongArchISD::VILVL.

Referenced by lower128BitShuffle().

◆ lowerVectorBitClear()

◆ lowerVectorBitClearImm()

◆ lowerVectorBitRevImm()

◆ lowerVectorBitSetImm()

◆ lowerVectorSplatImm()

◆ matchSetCC()

◆ matchShuffleAsByteRotate()

int matchShuffleAsByteRotate ( MVT VT,
SDValue & V1,
SDValue & V2,
ArrayRef< int > Mask )
static

◆ matchShuffleAsShift()

int matchShuffleAsShift ( MVT & ShiftVT,
unsigned & Opcode,
unsigned ScalarSizeInBits,
ArrayRef< int > Mask,
int MaskOffset,
const APInt & Zeroable )
static

◆ performANDCombine()

◆ performBITCASTCombine()

◆ performBITREV_WCombine()

◆ performBR_CCCombine()

◆ performEXTRACT_VECTOR_ELTCombine()

◆ performINTRINSIC_WO_CHAINCombine()

◆ performMOVFR2GR_SCombine()

◆ performMOVGR2FR_WCombine()

◆ performORCombine()

◆ performSELECT_CCCombine()

◆ performSETCC_BITCASTCombine()

◆ performSETCCCombine()

◆ performSPLIT_PAIR_F64Combine()

◆ performSRLCombine()

◆ performVMSKLTZCombine()

◆ replaceCMP_XCHG_128Results()

◆ replaceINTRINSIC_WO_CHAINResults()

◆ replaceVecCondBranchResults()

void replaceVecCondBranchResults ( SDNode * N,
SmallVectorImpl< SDValue > & Results,
SelectionDAG & DAG,
const LoongArchSubtarget & Subtarget,
unsigned ResOp )
static

◆ replaceVPICKVE2GRResults()

◆ signExtendBitcastSrcVector()

◆ STATISTIC()

STATISTIC ( NumTailCalls ,
"Number of tail calls"  )

◆ translateSetCCForBranch()

◆ truncateVecElts()

◆ unpackF64OnLA32DSoftABI()

◆ unpackFromMemLoc()

◆ unpackFromRegLoc()

◆ widenShuffleMask()

Variable Documentation

◆ ArgFPR32s

const MCPhysReg ArgFPR32s[]
Initial value:
= {LoongArch::F0, LoongArch::F1, LoongArch::F2,
LoongArch::F3, LoongArch::F4, LoongArch::F5,
LoongArch::F6, LoongArch::F7}

Definition at line 7154 of file LoongArchISelLowering.cpp.

Referenced by CC_LoongArch(), and llvm::CC_RISCV().

◆ ArgFPR64s

const MCPhysReg ArgFPR64s[]
Initial value:
= {
LoongArch::F0_64, LoongArch::F1_64, LoongArch::F2_64, LoongArch::F3_64,
LoongArch::F4_64, LoongArch::F5_64, LoongArch::F6_64, LoongArch::F7_64}

Definition at line 7158 of file LoongArchISelLowering.cpp.

Referenced by CC_LoongArch(), and llvm::CC_RISCV().

◆ ArgGPRs

const MCPhysReg ArgGPRs[]
Initial value:
= {LoongArch::R4, LoongArch::R5, LoongArch::R6,
LoongArch::R7, LoongArch::R8, LoongArch::R9,
LoongArch::R10, LoongArch::R11}

Definition at line 7149 of file LoongArchISelLowering.cpp.

Referenced by llvm::CC_CSKY_ABIV2_SOFT_64(), CC_LoongArch(), CC_LoongArchAssign2GRLen(), llvm::CC_RISCV(), llvm::CC_RISCV_FastCC(), CC_RISCVAssign2XLen(), llvm::LoongArchTargetLowering::LowerFormalArguments(), and llvm::Ret_CSKY_ABIV2_SOFT_64().

◆ ArgVRs

const MCPhysReg ArgVRs[]
Initial value:
= {LoongArch::VR0, LoongArch::VR1, LoongArch::VR2,
LoongArch::VR3, LoongArch::VR4, LoongArch::VR5,
LoongArch::VR6, LoongArch::VR7}

Definition at line 7162 of file LoongArchISelLowering.cpp.

Referenced by allocateRVVReg(), and CC_LoongArch().

◆ ArgXRs

const MCPhysReg ArgXRs[]
Initial value:
= {LoongArch::XR0, LoongArch::XR1, LoongArch::XR2,
LoongArch::XR3, LoongArch::XR4, LoongArch::XR5,
LoongArch::XR6, LoongArch::XR7}

Definition at line 7166 of file LoongArchISelLowering.cpp.

Referenced by CC_LoongArch().

◆ ZeroDivCheck

cl::opt< bool > ZeroDivCheck("loongarch-check-zero-division", cl::Hidden, cl::desc("Trap on integer division by zero."), cl::init(false)) ( "loongarch-check-zero-division" ,
cl::Hidden ,
cl::desc("Trap on integer division by zero.") ,
cl::init(false)  )
static

Referenced by insertDivByZeroTrap().