Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 2c8cf4b

Browse files
Tim NorthoverTim Northover
Tim Northover
authored and
Tim Northover
committed
Refactor to expose RTLIB calls to targets.
fp128 is almost but not quite completely illegal as a type on AArch64. As a result it needs to have a register class (for argument passing mainly), but all operations need to be lowered to runtime calls. Currently there's no way for targets to do this (without duplicating code), as the relevant functions are hidden in SelectionDAG. This patch changes that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171971 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b1349fa commit 2c8cf4b

File tree

7 files changed

+378
-337
lines changed

7 files changed

+378
-337
lines changed

include/llvm/Target/TargetLowering.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,6 +1848,17 @@ class TargetLowering {
18481848
return LibcallCallingConvs[Call];
18491849
}
18501850

1851+
bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
1852+
SDValue &Chain) const;
1853+
1854+
void softenSetCCOperands(SelectionDAG &DAG, EVT VT,
1855+
SDValue &NewLHS, SDValue &NewRHS,
1856+
ISD::CondCode &CCCode, DebugLoc DL) const;
1857+
1858+
SDValue makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT,
1859+
const SDValue *Ops, unsigned NumOps,
1860+
bool isSigned, DebugLoc dl) const;
1861+
18511862
private:
18521863
const TargetMachine &TM;
18531864
const DataLayout *TD;

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,26 +1841,6 @@ SDValue SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) {
18411841
return ExpandVectorBuildThroughStack(Node);
18421842
}
18431843

1844-
static bool isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
1845-
SDValue &Chain, const TargetLowering &TLI) {
1846-
const Function *F = DAG.getMachineFunction().getFunction();
1847-
1848-
// Conservatively require the attributes of the call to match those of
1849-
// the return. Ignore noalias because it doesn't affect the call sequence.
1850-
Attribute CallerRetAttr = F->getAttributes().getRetAttributes();
1851-
if (AttrBuilder(CallerRetAttr)
1852-
.removeAttribute(Attribute::NoAlias).hasAttributes())
1853-
return false;
1854-
1855-
// It's not safe to eliminate the sign / zero extension of the return value.
1856-
if (CallerRetAttr.hasAttribute(Attribute::ZExt) ||
1857-
CallerRetAttr.hasAttribute(Attribute::SExt))
1858-
return false;
1859-
1860-
// Check if the only use is a function return node.
1861-
return TLI.isUsedByReturnOnly(Node, Chain);
1862-
}
1863-
18641844
// ExpandLibCall - Expand a node into a call to a libcall. If the result value
18651845
// does not fit into a register, return the lo part and set the hi part to the
18661846
// by-reg argument. If it does fit into a single register, return the result
@@ -1891,7 +1871,7 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
18911871
// isTailCall may be true since the callee does not reference caller stack
18921872
// frame. Check if it's in the right position.
18931873
SDValue TCChain = InChain;
1894-
bool isTailCall = isInTailCallPosition(DAG, Node, TCChain, TLI);
1874+
bool isTailCall = TLI.isInTailCallPosition(DAG, Node, TCChain);
18951875
if (isTailCall)
18961876
InChain = TCChain;
18971877

lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 193 additions & 265 deletions
Large diffs are not rendered by default.

lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,8 @@ void DAGTypeLegalizer::ExpandIntRes_FP_TO_SINT(SDNode *N, SDValue &Lo,
17671767
SDValue Op = N->getOperand(0);
17681768
RTLIB::Libcall LC = RTLIB::getFPTOSINT(Op.getValueType(), VT);
17691769
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fp-to-sint conversion!");
1770-
SplitInteger(MakeLibCall(LC, VT, &Op, 1, true/*irrelevant*/, dl), Lo, Hi);
1770+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, &Op, 1, true/*irrelevant*/, dl),
1771+
Lo, Hi);
17711772
}
17721773

17731774
void DAGTypeLegalizer::ExpandIntRes_FP_TO_UINT(SDNode *N, SDValue &Lo,
@@ -1777,7 +1778,8 @@ void DAGTypeLegalizer::ExpandIntRes_FP_TO_UINT(SDNode *N, SDValue &Lo,
17771778
SDValue Op = N->getOperand(0);
17781779
RTLIB::Libcall LC = RTLIB::getFPTOUINT(Op.getValueType(), VT);
17791780
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fp-to-uint conversion!");
1780-
SplitInteger(MakeLibCall(LC, VT, &Op, 1, false/*irrelevant*/, dl), Lo, Hi);
1781+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, &Op, 1, false/*irrelevant*/, dl),
1782+
Lo, Hi);
17811783
}
17821784

17831785
void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
@@ -1992,7 +1994,8 @@ void DAGTypeLegalizer::ExpandIntRes_MUL(SDNode *N,
19921994
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported MUL!");
19931995

19941996
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
1995-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, true/*irrelevant*/, dl), Lo, Hi);
1997+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, true/*irrelevant*/, dl),
1998+
Lo, Hi);
19961999
}
19972000

19982001
void DAGTypeLegalizer::ExpandIntRes_SADDSUBO(SDNode *Node,
@@ -2054,7 +2057,7 @@ void DAGTypeLegalizer::ExpandIntRes_SDIV(SDNode *N,
20542057
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported SDIV!");
20552058

20562059
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
2057-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, true, dl), Lo, Hi);
2060+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, true, dl), Lo, Hi);
20582061
}
20592062

20602063
void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
@@ -2138,7 +2141,7 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
21382141

21392142
if (LC != RTLIB::UNKNOWN_LIBCALL && TLI.getLibcallName(LC)) {
21402143
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
2141-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
2144+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
21422145
return;
21432146
}
21442147

@@ -2221,7 +2224,7 @@ void DAGTypeLegalizer::ExpandIntRes_SREM(SDNode *N,
22212224
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported SREM!");
22222225

22232226
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
2224-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, true, dl), Lo, Hi);
2227+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, true, dl), Lo, Hi);
22252228
}
22262229

22272230
void DAGTypeLegalizer::ExpandIntRes_TRUNCATE(SDNode *N,
@@ -2361,7 +2364,7 @@ void DAGTypeLegalizer::ExpandIntRes_UDIV(SDNode *N,
23612364
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported UDIV!");
23622365

23632366
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
2364-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, false, dl), Lo, Hi);
2367+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, false, dl), Lo, Hi);
23652368
}
23662369

23672370
void DAGTypeLegalizer::ExpandIntRes_UREM(SDNode *N,
@@ -2381,7 +2384,7 @@ void DAGTypeLegalizer::ExpandIntRes_UREM(SDNode *N,
23812384
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported UREM!");
23822385

23832386
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
2384-
SplitInteger(MakeLibCall(LC, VT, Ops, 2, false, dl), Lo, Hi);
2387+
SplitInteger(TLI.makeLibCall(DAG, LC, VT, Ops, 2, false, dl), Lo, Hi);
23852388
}
23862389

23872390
void DAGTypeLegalizer::ExpandIntRes_ZERO_EXTEND(SDNode *N,
@@ -2668,7 +2671,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_SINT_TO_FP(SDNode *N) {
26682671
RTLIB::Libcall LC = RTLIB::getSINTTOFP(Op.getValueType(), DstVT);
26692672
assert(LC != RTLIB::UNKNOWN_LIBCALL &&
26702673
"Don't know how to expand this SINT_TO_FP!");
2671-
return MakeLibCall(LC, DstVT, &Op, 1, true, N->getDebugLoc());
2674+
return TLI.makeLibCall(DAG, LC, DstVT, &Op, 1, true, N->getDebugLoc());
26722675
}
26732676

26742677
SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
@@ -2846,7 +2849,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP(SDNode *N) {
28462849
RTLIB::Libcall LC = RTLIB::getUINTTOFP(SrcVT, DstVT);
28472850
assert(LC != RTLIB::UNKNOWN_LIBCALL &&
28482851
"Don't know how to expand this UINT_TO_FP!");
2849-
return MakeLibCall(LC, DstVT, &Op, 1, true, dl);
2852+
return TLI.makeLibCall(DAG, LC, DstVT, &Op, 1, true, dl);
28502853
}
28512854

28522855
SDValue DAGTypeLegalizer::ExpandIntOp_ATOMIC_STORE(SDNode *N) {

lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,50 +1020,20 @@ SDValue DAGTypeLegalizer::LibCallify(RTLIB::Libcall LC, SDNode *N,
10201020
unsigned NumOps = N->getNumOperands();
10211021
DebugLoc dl = N->getDebugLoc();
10221022
if (NumOps == 0) {
1023-
return MakeLibCall(LC, N->getValueType(0), 0, 0, isSigned, dl);
1023+
return TLI.makeLibCall(DAG, LC, N->getValueType(0), 0, 0, isSigned, dl);
10241024
} else if (NumOps == 1) {
10251025
SDValue Op = N->getOperand(0);
1026-
return MakeLibCall(LC, N->getValueType(0), &Op, 1, isSigned, dl);
1026+
return TLI.makeLibCall(DAG, LC, N->getValueType(0), &Op, 1, isSigned, dl);
10271027
} else if (NumOps == 2) {
10281028
SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
1029-
return MakeLibCall(LC, N->getValueType(0), Ops, 2, isSigned, dl);
1029+
return TLI.makeLibCall(DAG, LC, N->getValueType(0), Ops, 2, isSigned, dl);
10301030
}
10311031
SmallVector<SDValue, 8> Ops(NumOps);
10321032
for (unsigned i = 0; i < NumOps; ++i)
10331033
Ops[i] = N->getOperand(i);
10341034

1035-
return MakeLibCall(LC, N->getValueType(0), &Ops[0], NumOps, isSigned, dl);
1036-
}
1037-
1038-
/// MakeLibCall - Generate a libcall taking the given operands as arguments and
1039-
/// returning a result of type RetVT.
1040-
SDValue DAGTypeLegalizer::MakeLibCall(RTLIB::Libcall LC, EVT RetVT,
1041-
const SDValue *Ops, unsigned NumOps,
1042-
bool isSigned, DebugLoc dl) {
1043-
TargetLowering::ArgListTy Args;
1044-
Args.reserve(NumOps);
1045-
1046-
TargetLowering::ArgListEntry Entry;
1047-
for (unsigned i = 0; i != NumOps; ++i) {
1048-
Entry.Node = Ops[i];
1049-
Entry.Ty = Entry.Node.getValueType().getTypeForEVT(*DAG.getContext());
1050-
Entry.isSExt = isSigned;
1051-
Entry.isZExt = !isSigned;
1052-
Args.push_back(Entry);
1053-
}
1054-
SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
1055-
TLI.getPointerTy());
1056-
1057-
Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
1058-
TargetLowering::
1059-
CallLoweringInfo CLI(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
1060-
false, 0, TLI.getLibcallCallingConv(LC),
1061-
/*isTailCall=*/false,
1062-
/*doesNotReturn=*/false, /*isReturnValueUsed=*/true,
1063-
Callee, Args, DAG, dl);
1064-
std::pair<SDValue,SDValue> CallInfo = TLI.LowerCallTo(CLI);
1065-
1066-
return CallInfo.first;
1035+
return TLI.makeLibCall(DAG, LC, N->getValueType(0),
1036+
&Ops[0], NumOps, isSigned, dl);
10671037
}
10681038

10691039
// ExpandChainLibCall - Expand a node into a call to a libcall. Similar to

lib/CodeGen/SelectionDAG/LegalizeTypes.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
159159
SDValue GetVectorElementPointer(SDValue VecPtr, EVT EltVT, SDValue Index);
160160
SDValue JoinIntegers(SDValue Lo, SDValue Hi);
161161
SDValue LibCallify(RTLIB::Libcall LC, SDNode *N, bool isSigned);
162-
SDValue MakeLibCall(RTLIB::Libcall LC, EVT RetVT,
163-
const SDValue *Ops, unsigned NumOps, bool isSigned,
164-
DebugLoc dl);
165162

166163
std::pair<SDValue, SDValue> ExpandChainLibCall(RTLIB::Libcall LC,
167164
SDNode *Node, bool isSigned);
@@ -433,9 +430,6 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
433430
SDValue SoftenFloatOp_SETCC(SDNode *N);
434431
SDValue SoftenFloatOp_STORE(SDNode *N, unsigned OpNo);
435432

436-
void SoftenSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
437-
ISD::CondCode &CCCode, DebugLoc dl);
438-
439433
//===--------------------------------------------------------------------===//
440434
// Float Expansion Support: LegalizeFloatTypes.cpp
441435
//===--------------------------------------------------------------------===//

lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,161 @@ MVT::SimpleValueType TargetLowering::getCmpLibcallReturnType() const {
10121012
return MVT::i32; // return the default value
10131013
}
10141014

1015+
/// Check whether a given call node is in tail position within its function. If
1016+
/// so, it sets Chain to the input chain of the tail call.
1017+
bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
1018+
SDValue &Chain) const {
1019+
const Function *F = DAG.getMachineFunction().getFunction();
1020+
1021+
// Conservatively require the attributes of the call to match those of
1022+
// the return. Ignore noalias because it doesn't affect the call sequence.
1023+
Attribute CallerRetAttr = F->getAttributes().getRetAttributes();
1024+
if (AttrBuilder(CallerRetAttr)
1025+
.removeAttribute(Attribute::NoAlias).hasAttributes())
1026+
return false;
1027+
1028+
// It's not safe to eliminate the sign / zero extension of the return value.
1029+
if (CallerRetAttr.hasAttribute(Attribute::ZExt) ||
1030+
CallerRetAttr.hasAttribute(Attribute::SExt))
1031+
return false;
1032+
1033+
// Check if the only use is a function return node.
1034+
return isUsedByReturnOnly(Node, Chain);
1035+
}
1036+
1037+
1038+
/// Generate a libcall taking the given operands as arguments and returning a
1039+
/// result of type RetVT.
1040+
SDValue TargetLowering::makeLibCall(SelectionDAG &DAG,
1041+
RTLIB::Libcall LC, EVT RetVT,
1042+
const SDValue *Ops, unsigned NumOps,
1043+
bool isSigned, DebugLoc dl) const {
1044+
TargetLowering::ArgListTy Args;
1045+
Args.reserve(NumOps);
1046+
1047+
TargetLowering::ArgListEntry Entry;
1048+
for (unsigned i = 0; i != NumOps; ++i) {
1049+
Entry.Node = Ops[i];
1050+
Entry.Ty = Entry.Node.getValueType().getTypeForEVT(*DAG.getContext());
1051+
Entry.isSExt = isSigned;
1052+
Entry.isZExt = !isSigned;
1053+
Args.push_back(Entry);
1054+
}
1055+
SDValue Callee = DAG.getExternalSymbol(getLibcallName(LC), getPointerTy());
1056+
1057+
Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
1058+
TargetLowering::
1059+
CallLoweringInfo CLI(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
1060+
false, 0, getLibcallCallingConv(LC),
1061+
/*isTailCall=*/false,
1062+
/*doesNotReturn=*/false, /*isReturnValueUsed=*/true,
1063+
Callee, Args, DAG, dl);
1064+
std::pair<SDValue,SDValue> CallInfo = LowerCallTo(CLI);
1065+
1066+
return CallInfo.first;
1067+
}
1068+
1069+
1070+
/// SoftenSetCCOperands - Soften the operands of a comparison. This code is
1071+
/// shared among BR_CC, SELECT_CC, and SETCC handlers.
1072+
void TargetLowering::softenSetCCOperands(SelectionDAG &DAG, EVT VT,
1073+
SDValue &NewLHS, SDValue &NewRHS,
1074+
ISD::CondCode &CCCode,
1075+
DebugLoc dl) const {
1076+
assert((VT == MVT::f32 || VT == MVT::f64 || VT == MVT::f128)
1077+
&& "Unsupported setcc type!");
1078+
1079+
// Expand into one or more soft-fp libcall(s).
1080+
RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL;
1081+
switch (CCCode) {
1082+
case ISD::SETEQ:
1083+
case ISD::SETOEQ:
1084+
LC1 = (VT == MVT::f32) ? RTLIB::OEQ_F32 :
1085+
(VT == MVT::f64) ? RTLIB::OEQ_F64 : RTLIB::OEQ_F128;
1086+
break;
1087+
case ISD::SETNE:
1088+
case ISD::SETUNE:
1089+
LC1 = (VT == MVT::f32) ? RTLIB::UNE_F32 :
1090+
(VT == MVT::f64) ? RTLIB::UNE_F64 : RTLIB::UNE_F128;
1091+
break;
1092+
case ISD::SETGE:
1093+
case ISD::SETOGE:
1094+
LC1 = (VT == MVT::f32) ? RTLIB::OGE_F32 :
1095+
(VT == MVT::f64) ? RTLIB::OGE_F64 : RTLIB::OGE_F128;
1096+
break;
1097+
case ISD::SETLT:
1098+
case ISD::SETOLT:
1099+
LC1 = (VT == MVT::f32) ? RTLIB::OLT_F32 :
1100+
(VT == MVT::f64) ? RTLIB::OLT_F64 : RTLIB::OLT_F128;
1101+
break;
1102+
case ISD::SETLE:
1103+
case ISD::SETOLE:
1104+
LC1 = (VT == MVT::f32) ? RTLIB::OLE_F32 :
1105+
(VT == MVT::f64) ? RTLIB::OLE_F64 : RTLIB::OLE_F128;
1106+
break;
1107+
case ISD::SETGT:
1108+
case ISD::SETOGT:
1109+
LC1 = (VT == MVT::f32) ? RTLIB::OGT_F32 :
1110+
(VT == MVT::f64) ? RTLIB::OGT_F64 : RTLIB::OGT_F128;
1111+
break;
1112+
case ISD::SETUO:
1113+
LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 :
1114+
(VT == MVT::f64) ? RTLIB::UO_F64 : RTLIB::UO_F128;
1115+
break;
1116+
case ISD::SETO:
1117+
LC1 = (VT == MVT::f32) ? RTLIB::O_F32 :
1118+
(VT == MVT::f64) ? RTLIB::O_F64 : RTLIB::O_F128;
1119+
break;
1120+
default:
1121+
LC1 = (VT == MVT::f32) ? RTLIB::UO_F32 :
1122+
(VT == MVT::f64) ? RTLIB::UO_F64 : RTLIB::UO_F128;
1123+
switch (CCCode) {
1124+
case ISD::SETONE:
1125+
// SETONE = SETOLT | SETOGT
1126+
LC1 = (VT == MVT::f32) ? RTLIB::OLT_F32 :
1127+
(VT == MVT::f64) ? RTLIB::OLT_F64 : RTLIB::OLT_F128;
1128+
// Fallthrough
1129+
case ISD::SETUGT:
1130+
LC2 = (VT == MVT::f32) ? RTLIB::OGT_F32 :
1131+
(VT == MVT::f64) ? RTLIB::OGT_F64 : RTLIB::OGT_F128;
1132+
break;
1133+
case ISD::SETUGE:
1134+
LC2 = (VT == MVT::f32) ? RTLIB::OGE_F32 :
1135+
(VT == MVT::f64) ? RTLIB::OGE_F64 : RTLIB::OGE_F128;
1136+
break;
1137+
case ISD::SETULT:
1138+
LC2 = (VT == MVT::f32) ? RTLIB::OLT_F32 :
1139+
(VT == MVT::f64) ? RTLIB::OLT_F64 : RTLIB::OLT_F128;
1140+
break;
1141+
case ISD::SETULE:
1142+
LC2 = (VT == MVT::f32) ? RTLIB::OLE_F32 :
1143+
(VT == MVT::f64) ? RTLIB::OLE_F64 : RTLIB::OLE_F128;
1144+
break;
1145+
case ISD::SETUEQ:
1146+
LC2 = (VT == MVT::f32) ? RTLIB::OEQ_F32 :
1147+
(VT == MVT::f64) ? RTLIB::OEQ_F64 : RTLIB::OEQ_F128;
1148+
break;
1149+
default: llvm_unreachable("Do not know how to soften this setcc!");
1150+
}
1151+
}
1152+
1153+
// Use the target specific return value for comparions lib calls.
1154+
EVT RetVT = getCmpLibcallReturnType();
1155+
SDValue Ops[2] = { NewLHS, NewRHS };
1156+
NewLHS = makeLibCall(DAG, LC1, RetVT, Ops, 2, false/*sign irrelevant*/, dl);
1157+
NewRHS = DAG.getConstant(0, RetVT);
1158+
CCCode = getCmpLibcallCC(LC1);
1159+
if (LC2 != RTLIB::UNKNOWN_LIBCALL) {
1160+
SDValue Tmp = DAG.getNode(ISD::SETCC, dl, getSetCCResultType(RetVT),
1161+
NewLHS, NewRHS, DAG.getCondCode(CCCode));
1162+
NewLHS = makeLibCall(DAG, LC2, RetVT, Ops, 2, false/*sign irrelevant*/, dl);
1163+
NewLHS = DAG.getNode(ISD::SETCC, dl, getSetCCResultType(RetVT), NewLHS,
1164+
NewRHS, DAG.getCondCode(getCmpLibcallCC(LC2)));
1165+
NewLHS = DAG.getNode(ISD::OR, dl, Tmp.getValueType(), Tmp, NewLHS);
1166+
NewRHS = SDValue();
1167+
}
1168+
}
1169+
10151170
/// getVectorTypeBreakdown - Vector types are broken down into some number of
10161171
/// legal first class types. For example, MVT::v8f32 maps to 2 MVT::v4f32
10171172
/// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.

0 commit comments

Comments
 (0)