llvm.org GIT mirror llvm / ee84768
Revise per review of previous patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41645 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 12 years ago
3 changed file(s) with 29 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
9292 return B;
9393 }
9494
95 static inline std::string ftostr(APFloat V) {
95 static inline std::string ftostr(const APFloat& V) {
9696 if (&V.getSemantics() == &APFloat::IEEEsingle)
9797 return ftostr(V.convertToDouble());
9898 else if (&V.getSemantics() == &APFloat::IEEEdouble)
978978 APFloat::cmpResult R = N1C->getValueAPF().compare(N2C->getValueAPF());
979979 switch (Cond) {
980980 default: break;
981 case ISD::SETOEQ:
982 case ISD::SETEQ: return getConstant(R==APFloat::cmpEqual, VT);
983 case ISD::SETONE:
984 case ISD::SETNE: return getConstant(R==APFloat::cmpGreaterThan ||
981 case ISD::SETEQ: if (R==APFloat::cmpUnordered)
982 return getNode(ISD::UNDEF, VT);
983 // fall through
984 case ISD::SETOEQ: return getConstant(R==APFloat::cmpEqual, VT);
985 case ISD::SETNE: if (R==APFloat::cmpUnordered)
986 return getNode(ISD::UNDEF, VT);
987 // fall through
988 case ISD::SETONE: return getConstant(R==APFloat::cmpGreaterThan ||
985989 R==APFloat::cmpLessThan, VT);
986 case ISD::SETOLT:
987 case ISD::SETLT: return getConstant(R==APFloat::cmpLessThan, VT);
988 case ISD::SETOGT:
989 case ISD::SETGT: return getConstant(R==APFloat::cmpGreaterThan, VT);
990 case ISD::SETOLE:
991 case ISD::SETLE: return getConstant(R==APFloat::cmpLessThan ||
990 case ISD::SETLT: if (R==APFloat::cmpUnordered)
991 return getNode(ISD::UNDEF, VT);
992 // fall through
993 case ISD::SETOLT: return getConstant(R==APFloat::cmpLessThan, VT);
994 case ISD::SETGT: if (R==APFloat::cmpUnordered)
995 return getNode(ISD::UNDEF, VT);
996 // fall through
997 case ISD::SETOGT: return getConstant(R==APFloat::cmpGreaterThan, VT);
998 case ISD::SETLE: if (R==APFloat::cmpUnordered)
999 return getNode(ISD::UNDEF, VT);
1000 // fall through
1001 case ISD::SETOLE: return getConstant(R==APFloat::cmpLessThan ||
9921002 R==APFloat::cmpEqual, VT);
993 case ISD::SETOGE:
994 case ISD::SETGE: return getConstant(R==APFloat::cmpGreaterThan ||
1003 case ISD::SETGE: if (R==APFloat::cmpUnordered)
1004 return getNode(ISD::UNDEF, VT);
1005 // fall through
1006 case ISD::SETOGE: return getConstant(R==APFloat::cmpGreaterThan ||
9951007 R==APFloat::cmpEqual, VT);
9961008 case ISD::SETO: return getConstant(R!=APFloat::cmpUnordered, VT);
9971009 case ISD::SETUO: return getConstant(R==APFloat::cmpUnordered, VT);
403403 SDOperand Chain = CurDAG->getEntryNode(); // this is a constant, so..
404404
405405 SDOperand V;
406 if (cast(N)->getValueAPF().isPosZero()) {
406 ConstantFPSDNode* N2 = cast(N);
407 if (N2->getValueAPF().isPosZero()) {
407408 V = CurDAG->getCopyFromReg(Chain, IA64::F0, MVT::f64);
408 } else if (cast(N)->isExactlyValue(APFloat(+1.0))) {
409 } else if (N2->isExactlyValue(N2->getValueType(0) == MVT::f32 ?
410 APFloat(+1.0f) : APFloat(+1.0))) {
409411 V = CurDAG->getCopyFromReg(Chain, IA64::F1, MVT::f64);
410412 } else
411413 assert(0 && "Unexpected FP constant!");