mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Propagate debug info in LegalizeFloatTypes.
Complete (modulo bugs). llvm-svn: 63458
This commit is contained in:
parent
dc351f5461
commit
58ff487b47
@ -101,7 +101,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_BIT_CONVERT(SDNode *N) {
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(SDNode *N) {
|
||||
// Convert the inputs to integers, and build a new pair out of them.
|
||||
return DAG.getNode(ISD::BUILD_PAIR,
|
||||
return DAG.getNode(ISD::BUILD_PAIR, N->getDebugLoc(),
|
||||
TLI.getTypeToTransformTo(N->getValueType(0)),
|
||||
BitConvertToInteger(N->getOperand(0)),
|
||||
BitConvertToInteger(N->getOperand(1)));
|
||||
@ -120,7 +120,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FABS(SDNode *N) {
|
||||
SDValue Mask = DAG.getConstant(APInt::getAllOnesValue(Size).clear(Size-1),
|
||||
NVT);
|
||||
SDValue Op = GetSoftenedFloat(N->getOperand(0));
|
||||
return DAG.getNode(ISD::AND, NVT, Op, Mask);
|
||||
return DAG.getNode(ISD::AND, N->getDebugLoc(), NVT, Op, Mask);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_FADD(SDNode *N) {
|
||||
@ -149,6 +149,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FCEIL(SDNode *N) {
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(SDNode *N) {
|
||||
SDValue LHS = GetSoftenedFloat(N->getOperand(0));
|
||||
SDValue RHS = BitConvertToInteger(N->getOperand(1));
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
||||
MVT LVT = LHS.getValueType();
|
||||
MVT RVT = RHS.getValueType();
|
||||
@ -157,32 +158,32 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FCOPYSIGN(SDNode *N) {
|
||||
unsigned RSize = RVT.getSizeInBits();
|
||||
|
||||
// First get the sign bit of second operand.
|
||||
SDValue SignBit = DAG.getNode(ISD::SHL, RVT, DAG.getConstant(1, RVT),
|
||||
SDValue SignBit = DAG.getNode(ISD::SHL, dl, RVT, DAG.getConstant(1, RVT),
|
||||
DAG.getConstant(RSize - 1,
|
||||
TLI.getShiftAmountTy()));
|
||||
SignBit = DAG.getNode(ISD::AND, RVT, RHS, SignBit);
|
||||
SignBit = DAG.getNode(ISD::AND, dl, RVT, RHS, SignBit);
|
||||
|
||||
// Shift right or sign-extend it if the two operands have different types.
|
||||
int SizeDiff = RVT.getSizeInBits() - LVT.getSizeInBits();
|
||||
if (SizeDiff > 0) {
|
||||
SignBit = DAG.getNode(ISD::SRL, RVT, SignBit,
|
||||
SignBit = DAG.getNode(ISD::SRL, dl, RVT, SignBit,
|
||||
DAG.getConstant(SizeDiff, TLI.getShiftAmountTy()));
|
||||
SignBit = DAG.getNode(ISD::TRUNCATE, LVT, SignBit);
|
||||
SignBit = DAG.getNode(ISD::TRUNCATE, dl, LVT, SignBit);
|
||||
} else if (SizeDiff < 0) {
|
||||
SignBit = DAG.getNode(ISD::ANY_EXTEND, LVT, SignBit);
|
||||
SignBit = DAG.getNode(ISD::SHL, LVT, SignBit,
|
||||
SignBit = DAG.getNode(ISD::ANY_EXTEND, dl, LVT, SignBit);
|
||||
SignBit = DAG.getNode(ISD::SHL, dl, LVT, SignBit,
|
||||
DAG.getConstant(-SizeDiff, TLI.getShiftAmountTy()));
|
||||
}
|
||||
|
||||
// Clear the sign bit of the first operand.
|
||||
SDValue Mask = DAG.getNode(ISD::SHL, LVT, DAG.getConstant(1, LVT),
|
||||
SDValue Mask = DAG.getNode(ISD::SHL, dl, LVT, DAG.getConstant(1, LVT),
|
||||
DAG.getConstant(LSize - 1,
|
||||
TLI.getShiftAmountTy()));
|
||||
Mask = DAG.getNode(ISD::SUB, LVT, Mask, DAG.getConstant(1, LVT));
|
||||
LHS = DAG.getNode(ISD::AND, LVT, LHS, Mask);
|
||||
Mask = DAG.getNode(ISD::SUB, dl, LVT, Mask, DAG.getConstant(1, LVT));
|
||||
LHS = DAG.getNode(ISD::AND, dl, LVT, LHS, Mask);
|
||||
|
||||
// Or the value with the sign bit.
|
||||
return DAG.getNode(ISD::OR, LVT, LHS, SignBit);
|
||||
return DAG.getNode(ISD::OR, dl, LVT, LHS, SignBit);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_FCOS(SDNode *N) {
|
||||
@ -411,10 +412,11 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
|
||||
LoadSDNode *L = cast<LoadSDNode>(N);
|
||||
MVT VT = N->getValueType(0);
|
||||
MVT NVT = TLI.getTypeToTransformTo(VT);
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
||||
SDValue NewL;
|
||||
if (L->getExtensionType() == ISD::NON_EXTLOAD) {
|
||||
NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(),
|
||||
NewL = DAG.getLoad(L->getAddressingMode(), dl, L->getExtensionType(),
|
||||
NVT, L->getChain(), L->getBasePtr(), L->getOffset(),
|
||||
L->getSrcValue(), L->getSrcValueOffset(), NVT,
|
||||
L->isVolatile(), L->getAlignment());
|
||||
@ -425,7 +427,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
|
||||
}
|
||||
|
||||
// Do a non-extending load followed by FP_EXTEND.
|
||||
NewL = DAG.getLoad(L->getAddressingMode(), ISD::NON_EXTLOAD,
|
||||
NewL = DAG.getLoad(L->getAddressingMode(), dl, ISD::NON_EXTLOAD,
|
||||
L->getMemoryVT(), L->getChain(),
|
||||
L->getBasePtr(), L->getOffset(),
|
||||
L->getSrcValue(), L->getSrcValueOffset(),
|
||||
@ -434,19 +436,21 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
|
||||
// Legalized the chain result - switch anything that used the old chain to
|
||||
// use the new one.
|
||||
ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
|
||||
return BitConvertToInteger(DAG.getNode(ISD::FP_EXTEND, VT, NewL));
|
||||
return BitConvertToInteger(DAG.getNode(ISD::FP_EXTEND, dl, VT, NewL));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT(SDNode *N) {
|
||||
SDValue LHS = GetSoftenedFloat(N->getOperand(1));
|
||||
SDValue RHS = GetSoftenedFloat(N->getOperand(2));
|
||||
return DAG.getNode(ISD::SELECT, LHS.getValueType(), N->getOperand(0),LHS,RHS);
|
||||
return DAG.getNode(ISD::SELECT, N->getDebugLoc(),
|
||||
LHS.getValueType(), N->getOperand(0),LHS,RHS);
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatRes_SELECT_CC(SDNode *N) {
|
||||
SDValue LHS = GetSoftenedFloat(N->getOperand(2));
|
||||
SDValue RHS = GetSoftenedFloat(N->getOperand(3));
|
||||
return DAG.getNode(ISD::SELECT_CC, LHS.getValueType(), N->getOperand(0),
|
||||
return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(),
|
||||
LHS.getValueType(), N->getOperand(0),
|
||||
N->getOperand(1), LHS, RHS, N->getOperand(4));
|
||||
}
|
||||
|
||||
@ -471,7 +475,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_XINT_TO_FP(SDNode *N) {
|
||||
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported XINT_TO_FP!");
|
||||
|
||||
// Sign/zero extend the argument if the libcall takes a larger type.
|
||||
SDValue Op = DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND,
|
||||
SDValue Op = DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl,
|
||||
NVT, N->getOperand(0));
|
||||
return MakeLibCall(LC, TLI.getTypeToTransformTo(RVT), &Op, 1, false, dl);
|
||||
}
|
||||
@ -595,18 +599,18 @@ void DAGTypeLegalizer::SoftenSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
|
||||
NewRHS = DAG.getConstant(0, RetVT);
|
||||
CCCode = TLI.getCmpLibcallCC(LC1);
|
||||
if (LC2 != RTLIB::UNKNOWN_LIBCALL) {
|
||||
SDValue Tmp = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(RetVT),
|
||||
SDValue Tmp = DAG.getNode(ISD::SETCC, dl, TLI.getSetCCResultType(RetVT),
|
||||
NewLHS, NewRHS, DAG.getCondCode(CCCode));
|
||||
NewLHS = MakeLibCall(LC2, RetVT, Ops, 2, false/*sign irrelevant*/, dl);
|
||||
NewLHS = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(RetVT), NewLHS,
|
||||
NewLHS = DAG.getNode(ISD::SETCC, dl, TLI.getSetCCResultType(RetVT), NewLHS,
|
||||
NewRHS, DAG.getCondCode(TLI.getCmpLibcallCC(LC2)));
|
||||
NewLHS = DAG.getNode(ISD::OR, Tmp.getValueType(), Tmp, NewLHS);
|
||||
NewLHS = DAG.getNode(ISD::OR, dl, Tmp.getValueType(), Tmp, NewLHS);
|
||||
NewRHS = SDValue();
|
||||
}
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::SoftenFloatOp_BIT_CONVERT(SDNode *N) {
|
||||
return DAG.getNode(ISD::BIT_CONVERT, N->getValueType(0),
|
||||
return DAG.getNode(ISD::BIT_CONVERT, N->getDebugLoc(), N->getValueType(0),
|
||||
GetSoftenedFloat(N->getOperand(0)));
|
||||
}
|
||||
|
||||
@ -695,15 +699,16 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(SDNode *N, unsigned OpNo) {
|
||||
assert(OpNo == 1 && "Can only soften the stored value!");
|
||||
StoreSDNode *ST = cast<StoreSDNode>(N);
|
||||
SDValue Val = ST->getValue();
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
||||
if (ST->isTruncatingStore())
|
||||
// Do an FP_ROUND followed by a non-truncating store.
|
||||
Val = BitConvertToInteger(DAG.getNode(ISD::FP_ROUND, ST->getMemoryVT(),
|
||||
Val = BitConvertToInteger(DAG.getNode(ISD::FP_ROUND, dl, ST->getMemoryVT(),
|
||||
Val, DAG.getIntPtrConstant(0)));
|
||||
else
|
||||
Val = GetSoftenedFloat(Val);
|
||||
|
||||
return DAG.getStore(ST->getChain(), Val, ST->getBasePtr(),
|
||||
return DAG.getStore(ST->getChain(), dl, Val, ST->getBasePtr(),
|
||||
ST->getSrcValue(), ST->getSrcValueOffset(),
|
||||
ST->isVolatile(), ST->getAlignment());
|
||||
}
|
||||
@ -795,12 +800,13 @@ void DAGTypeLegalizer::ExpandFloatRes_FABS(SDNode *N, SDValue &Lo,
|
||||
SDValue &Hi) {
|
||||
assert(N->getValueType(0) == MVT::ppcf128 &&
|
||||
"Logic only correct for ppcf128!");
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
SDValue Tmp;
|
||||
GetExpandedFloat(N->getOperand(0), Lo, Tmp);
|
||||
Hi = DAG.getNode(ISD::FABS, Tmp.getValueType(), Tmp);
|
||||
Hi = DAG.getNode(ISD::FABS, dl, Tmp.getValueType(), Tmp);
|
||||
// Lo = Hi==fabs(Hi) ? Lo : -Lo;
|
||||
Lo = DAG.getNode(ISD::SELECT_CC, Lo.getValueType(), Tmp, Hi, Lo,
|
||||
DAG.getNode(ISD::FNEG, Lo.getValueType(), Lo),
|
||||
Lo = DAG.getNode(ISD::SELECT_CC, dl, Lo.getValueType(), Tmp, Hi, Lo,
|
||||
DAG.getNode(ISD::FNEG, dl, Lo.getValueType(), Lo),
|
||||
DAG.getCondCode(ISD::SETEQ));
|
||||
}
|
||||
|
||||
@ -948,15 +954,16 @@ void DAGTypeLegalizer::ExpandFloatRes_FNEARBYINT(SDNode *N,
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FNEG(SDNode *N, SDValue &Lo,
|
||||
SDValue &Hi) {
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
GetExpandedFloat(N->getOperand(0), Lo, Hi);
|
||||
Lo = DAG.getNode(ISD::FNEG, Lo.getValueType(), Lo);
|
||||
Hi = DAG.getNode(ISD::FNEG, Hi.getValueType(), Hi);
|
||||
Lo = DAG.getNode(ISD::FNEG, dl, Lo.getValueType(), Lo);
|
||||
Hi = DAG.getNode(ISD::FNEG, dl, Hi.getValueType(), Hi);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandFloatRes_FP_EXTEND(SDNode *N, SDValue &Lo,
|
||||
SDValue &Hi) {
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
Hi = DAG.getNode(ISD::FP_EXTEND, NVT, N->getOperand(0));
|
||||
Hi = DAG.getNode(ISD::FP_EXTEND, N->getDebugLoc(), NVT, N->getOperand(0));
|
||||
Lo = DAG.getConstantFP(APFloat(APInt(NVT.getSizeInBits(), 0)), NVT);
|
||||
}
|
||||
|
||||
@ -1052,12 +1059,13 @@ void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDValue &Lo,
|
||||
LoadSDNode *LD = cast<LoadSDNode>(N);
|
||||
SDValue Chain = LD->getChain();
|
||||
SDValue Ptr = LD->getBasePtr();
|
||||
DebugLoc dl = N->getDebugLoc();
|
||||
|
||||
MVT NVT = TLI.getTypeToTransformTo(LD->getValueType(0));
|
||||
assert(NVT.isByteSized() && "Expanded type not byte sized!");
|
||||
assert(LD->getMemoryVT().bitsLE(NVT) && "Float type not round?");
|
||||
|
||||
Hi = DAG.getExtLoad(LD->getExtensionType(), NVT, Chain, Ptr,
|
||||
Hi = DAG.getExtLoad(LD->getExtensionType(), dl, NVT, Chain, Ptr,
|
||||
LD->getSrcValue(), LD->getSrcValueOffset(),
|
||||
LD->getMemoryVT(),
|
||||
LD->isVolatile(), LD->getAlignment());
|
||||
@ -1088,14 +1096,14 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
|
||||
// though.
|
||||
if (SrcVT.bitsLE(MVT::i32)) {
|
||||
// The integer can be represented exactly in an f64.
|
||||
Src = DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND,
|
||||
Src = DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl,
|
||||
MVT::i32, Src);
|
||||
Lo = DAG.getConstantFP(APFloat(APInt(NVT.getSizeInBits(), 0)), NVT);
|
||||
Hi = DAG.getNode(ISD::SINT_TO_FP, NVT, Src);
|
||||
Hi = DAG.getNode(ISD::SINT_TO_FP, dl, NVT, Src);
|
||||
} else {
|
||||
RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
|
||||
if (SrcVT.bitsLE(MVT::i64)) {
|
||||
Src = DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND,
|
||||
Src = DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl,
|
||||
MVT::i64, Src);
|
||||
LC = RTLIB::SINTTOFP_I64_PPCF128;
|
||||
} else if (SrcVT.bitsLE(MVT::i128)) {
|
||||
@ -1114,7 +1122,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
|
||||
return;
|
||||
|
||||
// Unsigned - fix up the SINT_TO_FP value just calculated.
|
||||
Hi = DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi);
|
||||
Hi = DAG.getNode(ISD::BUILD_PAIR, dl, VT, Lo, Hi);
|
||||
SrcVT = Src.getValueType();
|
||||
|
||||
// x>=0 ? (ppcf128)(iN)x : (ppcf128)(iN)x + 2^N; N=32,64,128.
|
||||
@ -1137,13 +1145,13 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
|
||||
break;
|
||||
}
|
||||
|
||||
Lo = DAG.getNode(ISD::FADD, VT, Hi,
|
||||
Lo = DAG.getNode(ISD::FADD, dl, VT, Hi,
|
||||
DAG.getConstantFP(APFloat(APInt(128, 2, Parts)),
|
||||
MVT::ppcf128));
|
||||
Lo = DAG.getNode(ISD::SELECT_CC, VT, Src, DAG.getConstant(0, SrcVT), Lo, Hi,
|
||||
DAG.getCondCode(ISD::SETLT));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, DAG.getIntPtrConstant(1));
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Lo, DAG.getIntPtrConstant(0));
|
||||
Lo = DAG.getNode(ISD::SELECT_CC, dl, VT, Src, DAG.getConstant(0, SrcVT),
|
||||
Lo, Hi, DAG.getCondCode(ISD::SETLT));
|
||||
Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Lo, DAG.getIntPtrConstant(1));
|
||||
Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, NVT, Lo, DAG.getIntPtrConstant(0));
|
||||
}
|
||||
|
||||
|
||||
@ -1207,7 +1215,8 @@ bool DAGTypeLegalizer::ExpandFloatOperand(SDNode *N, unsigned OpNo) {
|
||||
/// is shared among BR_CC, SELECT_CC, and SETCC handlers.
|
||||
void DAGTypeLegalizer::FloatExpandSetCCOperands(SDValue &NewLHS,
|
||||
SDValue &NewRHS,
|
||||
ISD::CondCode &CCCode) {
|
||||
ISD::CondCode &CCCode,
|
||||
DebugLoc dl) {
|
||||
SDValue LHSLo, LHSHi, RHSLo, RHSHi;
|
||||
GetExpandedFloat(NewLHS, LHSLo, LHSHi);
|
||||
GetExpandedFloat(NewRHS, RHSLo, RHSHi);
|
||||
@ -1221,24 +1230,24 @@ void DAGTypeLegalizer::FloatExpandSetCCOperands(SDValue &NewLHS,
|
||||
// FCMPU crN, lo1, lo2
|
||||
// The following can be improved, but not that much.
|
||||
SDValue Tmp1, Tmp2, Tmp3;
|
||||
Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
Tmp1 = DAG.getSetCC(dl, TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
LHSHi, RHSHi, ISD::SETOEQ);
|
||||
Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSLo.getValueType()),
|
||||
Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(LHSLo.getValueType()),
|
||||
LHSLo, RHSLo, CCCode);
|
||||
Tmp3 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2);
|
||||
Tmp1 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
Tmp3 = DAG.getNode(ISD::AND, dl, Tmp1.getValueType(), Tmp1, Tmp2);
|
||||
Tmp1 = DAG.getSetCC(dl, TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
LHSHi, RHSHi, ISD::SETUNE);
|
||||
Tmp2 = DAG.getSetCC(TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
Tmp2 = DAG.getSetCC(dl, TLI.getSetCCResultType(LHSHi.getValueType()),
|
||||
LHSHi, RHSHi, CCCode);
|
||||
Tmp1 = DAG.getNode(ISD::AND, Tmp1.getValueType(), Tmp1, Tmp2);
|
||||
NewLHS = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp3);
|
||||
Tmp1 = DAG.getNode(ISD::AND, dl, Tmp1.getValueType(), Tmp1, Tmp2);
|
||||
NewLHS = DAG.getNode(ISD::OR, dl, Tmp1.getValueType(), Tmp1, Tmp3);
|
||||
NewRHS = SDValue(); // LHS is the result, not a compare.
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ExpandFloatOp_BR_CC(SDNode *N) {
|
||||
SDValue NewLHS = N->getOperand(2), NewRHS = N->getOperand(3);
|
||||
ISD::CondCode CCCode = cast<CondCodeSDNode>(N->getOperand(1))->get();
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode);
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode, N->getDebugLoc());
|
||||
|
||||
// If ExpandSetCCOperands returned a scalar, we need to compare the result
|
||||
// against zero to select between true and false values.
|
||||
@ -1259,7 +1268,8 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_ROUND(SDNode *N) {
|
||||
SDValue Lo, Hi;
|
||||
GetExpandedFloat(N->getOperand(0), Lo, Hi);
|
||||
// Round it the rest of the way (e.g. to f32) if needed.
|
||||
return DAG.getNode(ISD::FP_ROUND, N->getValueType(0), Hi, N->getOperand(1));
|
||||
return DAG.getNode(ISD::FP_ROUND, N->getDebugLoc(),
|
||||
N->getValueType(0), Hi, N->getOperand(1));
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(SDNode *N) {
|
||||
@ -1271,10 +1281,11 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_SINT(SDNode *N) {
|
||||
if (RVT == MVT::i32) {
|
||||
assert(N->getOperand(0).getValueType() == MVT::ppcf128 &&
|
||||
"Logic only correct for ppcf128!");
|
||||
SDValue Res = DAG.getNode(ISD::FP_ROUND_INREG, MVT::ppcf128,
|
||||
SDValue Res = DAG.getNode(ISD::FP_ROUND_INREG, dl, MVT::ppcf128,
|
||||
N->getOperand(0), DAG.getValueType(MVT::f64));
|
||||
Res = DAG.getNode(ISD::FP_ROUND, MVT::f64, Res, DAG.getIntPtrConstant(1));
|
||||
return DAG.getNode(ISD::FP_TO_SINT, MVT::i32, Res);
|
||||
Res = DAG.getNode(ISD::FP_ROUND, dl, MVT::f64, Res,
|
||||
DAG.getIntPtrConstant(1));
|
||||
return DAG.getNode(ISD::FP_TO_SINT, dl, MVT::i32, Res);
|
||||
}
|
||||
|
||||
RTLIB::Libcall LC = RTLIB::getFPTOSINT(N->getOperand(0).getValueType(), RVT);
|
||||
@ -1296,15 +1307,16 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(SDNode *N) {
|
||||
SDValue Tmp = DAG.getConstantFP(APF, MVT::ppcf128);
|
||||
// X>=2^31 ? (int)(X-2^31)+0x80000000 : (int)X
|
||||
// FIXME: generated code sucks.
|
||||
return DAG.getNode(ISD::SELECT_CC, MVT::i32, N->getOperand(0), Tmp,
|
||||
DAG.getNode(ISD::ADD, MVT::i32,
|
||||
DAG.getNode(ISD::FP_TO_SINT, MVT::i32,
|
||||
DAG.getNode(ISD::FSUB,
|
||||
return DAG.getNode(ISD::SELECT_CC, dl, MVT::i32, N->getOperand(0), Tmp,
|
||||
DAG.getNode(ISD::ADD, dl, MVT::i32,
|
||||
DAG.getNode(ISD::FP_TO_SINT, dl, MVT::i32,
|
||||
DAG.getNode(ISD::FSUB, dl,
|
||||
MVT::ppcf128,
|
||||
N->getOperand(0),
|
||||
Tmp)),
|
||||
DAG.getConstant(0x80000000, MVT::i32)),
|
||||
DAG.getNode(ISD::FP_TO_SINT, MVT::i32, N->getOperand(0)),
|
||||
DAG.getNode(ISD::FP_TO_SINT, dl,
|
||||
MVT::i32, N->getOperand(0)),
|
||||
DAG.getCondCode(ISD::SETGE));
|
||||
}
|
||||
|
||||
@ -1316,7 +1328,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_FP_TO_UINT(SDNode *N) {
|
||||
SDValue DAGTypeLegalizer::ExpandFloatOp_SELECT_CC(SDNode *N) {
|
||||
SDValue NewLHS = N->getOperand(0), NewRHS = N->getOperand(1);
|
||||
ISD::CondCode CCCode = cast<CondCodeSDNode>(N->getOperand(4))->get();
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode);
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode, N->getDebugLoc());
|
||||
|
||||
// If ExpandSetCCOperands returned a scalar, we need to compare the result
|
||||
// against zero to select between true and false values.
|
||||
@ -1334,7 +1346,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_SELECT_CC(SDNode *N) {
|
||||
SDValue DAGTypeLegalizer::ExpandFloatOp_SETCC(SDNode *N) {
|
||||
SDValue NewLHS = N->getOperand(0), NewRHS = N->getOperand(1);
|
||||
ISD::CondCode CCCode = cast<CondCodeSDNode>(N->getOperand(2))->get();
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode);
|
||||
FloatExpandSetCCOperands(NewLHS, NewRHS, CCCode, N->getDebugLoc());
|
||||
|
||||
// If ExpandSetCCOperands returned a scalar, use it.
|
||||
if (NewRHS.getNode() == 0) {
|
||||
@ -1366,7 +1378,7 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
|
||||
SDValue Lo, Hi;
|
||||
GetExpandedOp(ST->getValue(), Lo, Hi);
|
||||
|
||||
return DAG.getTruncStore(Chain, Hi, Ptr,
|
||||
return DAG.getTruncStore(Chain, N->getDebugLoc(), Hi, Ptr,
|
||||
ST->getSrcValue(), ST->getSrcValueOffset(),
|
||||
ST->getMemoryVT(),
|
||||
ST->isVolatile(), ST->getAlignment());
|
||||
|
@ -481,7 +481,7 @@ private:
|
||||
SDValue ExpandFloatOp_STORE(SDNode *N, unsigned OpNo);
|
||||
|
||||
void FloatExpandSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
|
||||
ISD::CondCode &CCCode);
|
||||
ISD::CondCode &CCCode, DebugLoc dl);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Scalarization Support: LegalizeVectorTypes.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user