}
// If Result is null, the sub-method took care of registering the result.
- if (Result.Val)
+ if (Result.getNode())
SetPromotedInteger(SDValue(N, ResNo), Result);
}
// Otherwise, lower the bit-convert to a store/load from the stack, then
// promote the load.
SDValue Op = CreateStackStoreLoad(InOp, N->getValueType(0));
- return PromoteIntRes_LOAD(cast<LoadSDNode>(Op.Val));
+ return PromoteIntRes_LOAD(cast<LoadSDNode>(Op.getNode()));
}
SDValue DAGTypeLegalizer::PromoteIntRes_BSWAP(SDNode *N) {
if (TLI.isBigEndian())
std::swap(Lo, Hi);
- SDValue Odd = DAG.getNode(ISD::AND, OldIdx.getValueType(), OldIdx,
- DAG.getConstant(1, TLI.getShiftAmountTy()));
+ SDValue Odd = DAG.getNode(ISD::TRUNCATE, MVT::i1, OldIdx);
return DAG.getNode(ISD::SELECT, NewVT, Odd, Hi, Lo);
}
}
SDValue DAGTypeLegalizer::PromoteIntRes_SETCC(SDNode *N) {
- assert(isTypeLegal(TLI.getSetCCResultType(N->getOperand(0)))
- && "SetCC type is not legal??");
- return DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(N->getOperand(0)),
- N->getOperand(0), N->getOperand(1), N->getOperand(2));
+ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
+ MVT SVT = TLI.getSetCCResultType(N->getOperand(0));
+ assert(isTypeLegal(SVT) && "SetCC type not legal??");
+ assert(NVT.getSizeInBits() <= SVT.getSizeInBits() &&
+ "Integer type overpromoted?");
+ return DAG.getNode(ISD::TRUNCATE, NVT,
+ DAG.getNode(ISD::SETCC, SVT, N->getOperand(0),
+ N->getOperand(1), N->getOperand(2)));
}
SDValue DAGTypeLegalizer::PromoteIntRes_SHL(SDNode *N) {
== TargetLowering::Custom)
Res = TLI.LowerOperation(SDValue(N, OpNo), DAG);
- if (Res.Val == 0) {
+ if (Res.getNode() == 0) {
switch (N->getOpcode()) {
default:
#ifndef NDEBUG
}
// If the result is null, the sub-method took care of registering results etc.
- if (!Res.Val) return false;
+ if (!Res.getNode()) return false;
// If the result is N, the sub-method updated N in place.
- if (Res.Val == N) {
+ if (Res.getNode() == N) {
// Mark N as new and remark N and its operands. This allows us to correctly
// revisit N if it needs another step of promotion and allows us to visit
// any new operands to N.
}
// If Lo/Hi is null, the sub-method took care of registering results etc.
- if (Lo.Val)
+ if (Lo.getNode())
SetExpandedInteger(SDValue(N, ResNo), Lo, Hi);
}
if (HasUMUL_LOHI) {
// We can emit a umul_lohi.
Lo = DAG.getNode(ISD::UMUL_LOHI, DAG.getVTList(NVT, NVT), LL, RL);
- Hi = SDValue(Lo.Val, 1);
+ Hi = SDValue(Lo.getNode(), 1);
return;
}
if (HasMULHU) {
if (HasSMUL_LOHI) {
// We can emit a smul_lohi.
Lo = DAG.getNode(ISD::SMUL_LOHI, DAG.getVTList(NVT, NVT), LL, RL);
- Hi = SDValue(Lo.Val, 1);
+ Hi = SDValue(Lo.getNode(), 1);
return;
}
if (HasMULHS) {
// If we can emit an efficient shift operation, do so now. Check to see if
// the RHS is a constant.
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1)))
- return ExpandShiftByConstant(N, CN->getValue(), Lo, Hi);
+ return ExpandShiftByConstant(N, CN->getZExtValue(), Lo, Hi);
// If we can determine that the high bit of the shift is zero or one, even if
// the low bits are variable, emit this shift in an optimized form.
== TargetLowering::Custom)
Res = TLI.LowerOperation(SDValue(N, OpNo), DAG);
- if (Res.Val == 0) {
+ if (Res.getNode() == 0) {
switch (N->getOpcode()) {
default:
#ifndef NDEBUG
}
// If the result is null, the sub-method took care of registering results etc.
- if (!Res.Val) return false;
+ if (!Res.getNode()) return false;
// If the result is N, the sub-method updated N in place. Check to see if any
// operands are new, and if so, mark them.
- if (Res.Val == N) {
+ if (Res.getNode() == N) {
// Mark N as new and remark N and its operands. This allows us to correctly
// revisit N if it needs another step of expansion and allows us to visit
// any new operands to N.
SDValue Tmp1, Tmp2;
Tmp1 = TLI.SimplifySetCC(TLI.getSetCCResultType(LHSLo), LHSLo, RHSLo, LowCC,
false, DagCombineInfo);
- if (!Tmp1.Val)
+ if (!Tmp1.getNode())
Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSLo), LHSLo, RHSLo, LowCC);
Tmp2 = TLI.SimplifySetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi,
CCCode, false, DagCombineInfo);
- if (!Tmp2.Val)
+ if (!Tmp2.getNode())
Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi,
DAG.getCondCode(CCCode));
- ConstantSDNode *Tmp1C = dyn_cast<ConstantSDNode>(Tmp1.Val);
- ConstantSDNode *Tmp2C = dyn_cast<ConstantSDNode>(Tmp2.Val);
+ ConstantSDNode *Tmp1C = dyn_cast<ConstantSDNode>(Tmp1.getNode());
+ ConstantSDNode *Tmp2C = dyn_cast<ConstantSDNode>(Tmp2.getNode());
if ((Tmp1C && Tmp1C->isNullValue()) ||
(Tmp2C && Tmp2C->isNullValue() &&
(CCCode == ISD::SETLE || CCCode == ISD::SETGE ||
NewLHS = TLI.SimplifySetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi,
ISD::SETEQ, false, DagCombineInfo);
- if (!NewLHS.Val)
+ if (!NewLHS.getNode())
NewLHS = DAG.getSetCC(TLI.getSetCCResultType(LHSHi), LHSHi, RHSHi,
ISD::SETEQ);
NewLHS = DAG.getNode(ISD::SELECT, Tmp1.getValueType(),
// If ExpandSetCCOperands returned a scalar, we need to compare the result
// against zero to select between true and false values.
- if (NewRHS.Val == 0) {
+ if (NewRHS.getNode() == 0) {
NewRHS = DAG.getConstant(0, NewLHS.getValueType());
CCCode = ISD::SETNE;
}
// If ExpandSetCCOperands returned a scalar, we need to compare the result
// against zero to select between true and false values.
- if (NewRHS.Val == 0) {
+ if (NewRHS.getNode() == 0) {
NewRHS = DAG.getConstant(0, NewLHS.getValueType());
CCCode = ISD::SETNE;
}
IntegerExpandSetCCOperands(NewLHS, NewRHS, CCCode);
// If ExpandSetCCOperands returned a scalar, use it.
- if (NewRHS.Val == 0) {
+ if (NewRHS.getNode() == 0) {
assert(NewLHS.getValueType() == N->getValueType(0) &&
"Unexpected setcc expansion!");
return NewLHS;
if (TLI.isBigEndian()) std::swap(Zero, Four);
SDValue Offset = DAG.getNode(ISD::SELECT, Zero.getValueType(), SignSet,
Zero, Four);
+ unsigned Alignment =
+ 1 << cast<ConstantPoolSDNode>(FudgePtr)->getAlignment();
FudgePtr = DAG.getNode(ISD::ADD, TLI.getPointerTy(), FudgePtr, Offset);
+ Alignment = std::min(Alignment, 4u);
// Load the value out, extending it from f32 to the destination float type.
// FIXME: Avoid the extend by constructing the right constant pool?
SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, DstVT, DAG.getEntryNode(),
- FudgePtr, NULL, 0, MVT::f32);
+ FudgePtr, NULL, 0, MVT::f32,
+ false, Alignment);
return DAG.getNode(ISD::FADD, DstVT, SignedConv, Fudge);
}