forked from OSchip/llvm-project
Use MVT instead of EVT in X86ISelDAGToDAG since all the types should be legal.
llvm-svn: 188446
This commit is contained in:
parent
6f4dd2dacf
commit
83e042a21b
|
@ -183,7 +183,7 @@ namespace {
|
|||
SDNode *Select(SDNode *N);
|
||||
SDNode *SelectGather(SDNode *N, unsigned Opc);
|
||||
SDNode *SelectAtomic64(SDNode *Node, unsigned Opc);
|
||||
SDNode *SelectAtomicLoadArith(SDNode *Node, EVT NVT);
|
||||
SDNode *SelectAtomicLoadArith(SDNode *Node, MVT NVT);
|
||||
|
||||
bool FoldOffsetIntoAddress(uint64_t Offset, X86ISelAddressMode &AM);
|
||||
bool MatchLoadInAddress(LoadSDNode *N, X86ISelAddressMode &AM);
|
||||
|
@ -491,8 +491,8 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
|
|||
if (N->getOpcode() != ISD::FP_ROUND && N->getOpcode() != ISD::FP_EXTEND)
|
||||
continue;
|
||||
|
||||
EVT SrcVT = N->getOperand(0).getValueType();
|
||||
EVT DstVT = N->getValueType(0);
|
||||
MVT SrcVT = N->getOperand(0).getSimpleValueType();
|
||||
MVT DstVT = N->getSimpleValueType(0);
|
||||
|
||||
// If any of the sources are vectors, no fp stack involved.
|
||||
if (SrcVT.isVector() || DstVT.isVector())
|
||||
|
@ -519,7 +519,7 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
|
|||
// Here we could have an FP stack truncation or an FPStack <-> SSE convert.
|
||||
// FPStack has extload and truncstore. SSE can fold direct loads into other
|
||||
// operations. Based on this, decide what we want to do.
|
||||
EVT MemVT;
|
||||
MVT MemVT;
|
||||
if (N->getOpcode() == ISD::FP_ROUND)
|
||||
MemVT = DstVT; // FP_ROUND must use DstVT, we can't do a 'trunc load'.
|
||||
else
|
||||
|
@ -783,7 +783,7 @@ static bool FoldMaskAndShiftToExtract(SelectionDAG &DAG, SDValue N,
|
|||
Mask != (0xffu << ScaleLog))
|
||||
return true;
|
||||
|
||||
EVT VT = N.getValueType();
|
||||
MVT VT = N.getSimpleValueType();
|
||||
SDLoc DL(N);
|
||||
SDValue Eight = DAG.getConstant(8, MVT::i8);
|
||||
SDValue NewMask = DAG.getConstant(0xff, VT);
|
||||
|
@ -831,7 +831,7 @@ static bool FoldMaskedShiftToScaledMask(SelectionDAG &DAG, SDValue N,
|
|||
if (ShiftAmt != 1 && ShiftAmt != 2 && ShiftAmt != 3)
|
||||
return true;
|
||||
|
||||
EVT VT = N.getValueType();
|
||||
MVT VT = N.getSimpleValueType();
|
||||
SDLoc DL(N);
|
||||
SDValue NewMask = DAG.getConstant(Mask >> ShiftAmt, VT);
|
||||
SDValue NewAnd = DAG.getNode(ISD::AND, DL, VT, X, NewMask);
|
||||
|
@ -904,7 +904,7 @@ static bool FoldMaskAndShiftToScale(SelectionDAG &DAG, SDValue N,
|
|||
|
||||
// Scale the leading zero count down based on the actual size of the value.
|
||||
// Also scale it down based on the size of the shift.
|
||||
MaskLZ -= (64 - X.getValueSizeInBits()) + ShiftAmt;
|
||||
MaskLZ -= (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt;
|
||||
|
||||
// The final check is to ensure that any masked out high bits of X are
|
||||
// already known to be zero. Otherwise, the mask has a semantic impact
|
||||
|
@ -914,23 +914,23 @@ static bool FoldMaskAndShiftToScale(SelectionDAG &DAG, SDValue N,
|
|||
// replace them with zero extensions cheaply if necessary.
|
||||
bool ReplacingAnyExtend = false;
|
||||
if (X.getOpcode() == ISD::ANY_EXTEND) {
|
||||
unsigned ExtendBits =
|
||||
X.getValueSizeInBits() - X.getOperand(0).getValueSizeInBits();
|
||||
unsigned ExtendBits = X.getSimpleValueType().getSizeInBits() -
|
||||
X.getOperand(0).getSimpleValueType().getSizeInBits();
|
||||
// Assume that we'll replace the any-extend with a zero-extend, and
|
||||
// narrow the search to the extended value.
|
||||
X = X.getOperand(0);
|
||||
MaskLZ = ExtendBits > MaskLZ ? 0 : MaskLZ - ExtendBits;
|
||||
ReplacingAnyExtend = true;
|
||||
}
|
||||
APInt MaskedHighBits = APInt::getHighBitsSet(X.getValueSizeInBits(),
|
||||
MaskLZ);
|
||||
APInt MaskedHighBits =
|
||||
APInt::getHighBitsSet(X.getSimpleValueType().getSizeInBits(), MaskLZ);
|
||||
APInt KnownZero, KnownOne;
|
||||
DAG.ComputeMaskedBits(X, KnownZero, KnownOne);
|
||||
if (MaskedHighBits != KnownZero) return true;
|
||||
|
||||
// We've identified a pattern that can be transformed into a single shift
|
||||
// and an addressing mode. Make it so.
|
||||
EVT VT = N.getValueType();
|
||||
MVT VT = N.getSimpleValueType();
|
||||
if (ReplacingAnyExtend) {
|
||||
assert(X.getValueType() != VT);
|
||||
// We looked through an ANY_EXTEND node, insert a ZERO_EXTEND.
|
||||
|
@ -1059,7 +1059,7 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM,
|
|||
|
||||
// We only handle up to 64-bit values here as those are what matter for
|
||||
// addressing mode optimizations.
|
||||
if (X.getValueSizeInBits() > 64) break;
|
||||
if (X.getSimpleValueType().getSizeInBits() > 64) break;
|
||||
|
||||
// The mask used for the transform is expected to be post-shift, but we
|
||||
// found the shift first so just apply the shift to the mask before passing
|
||||
|
@ -1244,7 +1244,7 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM,
|
|||
|
||||
// We only handle up to 64-bit values here as those are what matter for
|
||||
// addressing mode optimizations.
|
||||
if (X.getValueSizeInBits() > 64) break;
|
||||
if (X.getSimpleValueType().getSizeInBits() > 64) break;
|
||||
|
||||
if (!isa<ConstantSDNode>(N.getOperand(1)))
|
||||
break;
|
||||
|
@ -1323,7 +1323,7 @@ bool X86DAGToDAGISel::SelectAddr(SDNode *Parent, SDValue N, SDValue &Base,
|
|||
if (MatchAddress(N, AM))
|
||||
return false;
|
||||
|
||||
EVT VT = N.getValueType();
|
||||
MVT VT = N.getSimpleValueType();
|
||||
if (AM.BaseType == X86ISelAddressMode::RegBase) {
|
||||
if (!AM.Base_Reg.getNode())
|
||||
AM.Base_Reg = CurDAG->getRegister(0, VT);
|
||||
|
@ -1465,7 +1465,7 @@ bool X86DAGToDAGISel::SelectLEAAddr(SDValue N,
|
|||
assert (T == AM.Segment);
|
||||
AM.Segment = Copy;
|
||||
|
||||
EVT VT = N.getValueType();
|
||||
MVT VT = N.getSimpleValueType();
|
||||
unsigned Complexity = 0;
|
||||
if (AM.BaseType == X86ISelAddressMode::RegBase)
|
||||
if (AM.Base_Reg.getNode())
|
||||
|
@ -1706,7 +1706,7 @@ static const uint16_t AtomicOpcTbl[AtomicOpcEnd][AtomicSzEnd] = {
|
|||
// + non-empty, otherwise.
|
||||
static SDValue getAtomicLoadArithTargetConstant(SelectionDAG *CurDAG,
|
||||
SDLoc dl,
|
||||
enum AtomicOpc &Op, EVT NVT,
|
||||
enum AtomicOpc &Op, MVT NVT,
|
||||
SDValue Val) {
|
||||
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Val)) {
|
||||
int64_t CNVal = CN->getSExtValue();
|
||||
|
@ -1753,7 +1753,7 @@ static SDValue getAtomicLoadArithTargetConstant(SelectionDAG *CurDAG,
|
|||
return Val;
|
||||
}
|
||||
|
||||
SDNode *X86DAGToDAGISel::SelectAtomicLoadArith(SDNode *Node, EVT NVT) {
|
||||
SDNode *X86DAGToDAGISel::SelectAtomicLoadArith(SDNode *Node, MVT NVT) {
|
||||
if (Node->hasAnyUseOfValue(0))
|
||||
return 0;
|
||||
|
||||
|
@ -1793,7 +1793,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadArith(SDNode *Node, EVT NVT) {
|
|||
bool isCN = Val.getNode() && (Val.getOpcode() == ISD::TargetConstant);
|
||||
|
||||
unsigned Opc = 0;
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: return 0;
|
||||
case MVT::i8:
|
||||
if (isCN)
|
||||
|
@ -2047,7 +2047,7 @@ SDNode *X86DAGToDAGISel::SelectGather(SDNode *Node, unsigned Opc) {
|
|||
}
|
||||
|
||||
SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
||||
EVT NVT = Node->getValueType(0);
|
||||
MVT NVT = Node->getSimpleValueType(0);
|
||||
unsigned Opc, MOpc;
|
||||
unsigned Opcode = Node->getOpcode();
|
||||
SDLoc dl(Node);
|
||||
|
@ -2187,7 +2187,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
break;
|
||||
|
||||
unsigned ShlOp, Op;
|
||||
EVT CstVT = NVT;
|
||||
MVT CstVT = NVT;
|
||||
|
||||
// Check the minimum bitwidth for the new constant.
|
||||
// TODO: AND32ri is the same as AND64ri32 with zext imm.
|
||||
|
@ -2202,7 +2202,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
if (NVT == CstVT)
|
||||
break;
|
||||
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i32:
|
||||
assert(CstVT == MVT::i8);
|
||||
|
@ -2239,7 +2239,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
SDValue N1 = Node->getOperand(1);
|
||||
|
||||
unsigned LoReg;
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8: LoReg = X86::AL; Opc = X86::MUL8r; break;
|
||||
case MVT::i16: LoReg = X86::AX; Opc = X86::MUL16r; break;
|
||||
|
@ -2268,7 +2268,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
bool isSigned = Opcode == ISD::SMUL_LOHI;
|
||||
bool hasBMI2 = Subtarget->hasBMI2();
|
||||
if (!isSigned) {
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8: Opc = X86::MUL8r; MOpc = X86::MUL8m; break;
|
||||
case MVT::i16: Opc = X86::MUL16r; MOpc = X86::MUL16m; break;
|
||||
|
@ -2278,7 +2278,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
MOpc = hasBMI2 ? X86::MULX64rm : X86::MUL64m; break;
|
||||
}
|
||||
} else {
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8: Opc = X86::IMUL8r; MOpc = X86::IMUL8m; break;
|
||||
case MVT::i16: Opc = X86::IMUL16r; MOpc = X86::IMUL16m; break;
|
||||
|
@ -2415,7 +2415,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
|
||||
bool isSigned = Opcode == ISD::SDIVREM;
|
||||
if (!isSigned) {
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8: Opc = X86::DIV8r; MOpc = X86::DIV8m; break;
|
||||
case MVT::i16: Opc = X86::DIV16r; MOpc = X86::DIV16m; break;
|
||||
|
@ -2423,7 +2423,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
case MVT::i64: Opc = X86::DIV64r; MOpc = X86::DIV64m; break;
|
||||
}
|
||||
} else {
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8: Opc = X86::IDIV8r; MOpc = X86::IDIV8m; break;
|
||||
case MVT::i16: Opc = X86::IDIV16r; MOpc = X86::IDIV16m; break;
|
||||
|
@ -2434,7 +2434,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
|
||||
unsigned LoReg, HiReg, ClrReg;
|
||||
unsigned SExtOpcode;
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
default: llvm_unreachable("Unsupported VT!");
|
||||
case MVT::i8:
|
||||
LoReg = X86::AL; ClrReg = HiReg = X86::AH;
|
||||
|
@ -2489,7 +2489,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
|
|||
} else {
|
||||
// Zero out the high part, effectively zero extending the input.
|
||||
SDValue ClrNode = SDValue(CurDAG->getMachineNode(X86::MOV32r0, dl, NVT), 0);
|
||||
switch (NVT.getSimpleVT().SimpleTy) {
|
||||
switch (NVT.SimpleTy) {
|
||||
case MVT::i16:
|
||||
ClrNode =
|
||||
SDValue(CurDAG->getMachineNode(
|
||||
|
|
Loading…
Reference in New Issue