Added floating point conditional operations support via libcalls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74187 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjiv Gupta 2009-06-25 18:12:06 +00:00
parent 2b0de6a286
commit cbd5f0a6b9

View File

@ -97,6 +97,16 @@ static const char *getIntrinsicName(unsigned opcode) {
case RTLIB::SUB_F32: Basename = "sub.f32"; break;
case RTLIB::MUL_F32: Basename = "mul.f32"; break;
case RTLIB::DIV_F32: Basename = "div.f32"; break;
// Floating point comparison
case RTLIB::O_F32: Basename = "unordered.f32"; break;
case RTLIB::UO_F32: Basename = "unordered.f32"; break;
case RTLIB::OLE_F32: Basename = "le.f32"; break;
case RTLIB::OGE_F32: Basename = "ge.f32"; break;
case RTLIB::OLT_F32: Basename = "lt.f32"; break;
case RTLIB::OGT_F32: Basename = "gt.f32"; break;
case RTLIB::OEQ_F32: Basename = "eq.f32"; break;
case RTLIB::UNE_F32: Basename = "neq.f32"; break;
}
std::string prefix = PAN::getTagName(PAN::PREFIX_SYMBOL);
@ -187,6 +197,25 @@ PIC16TargetLowering::PIC16TargetLowering(PIC16TargetMachine &TM)
setLibcallName(RTLIB::MUL_F32, getIntrinsicName(RTLIB::MUL_F32));
setLibcallName(RTLIB::DIV_F32, getIntrinsicName(RTLIB::DIV_F32));
// Floationg point comparison
setLibcallName(RTLIB::UO_F32, getIntrinsicName(RTLIB::UO_F32));
setLibcallName(RTLIB::OLE_F32, getIntrinsicName(RTLIB::OLE_F32));
setLibcallName(RTLIB::OGE_F32, getIntrinsicName(RTLIB::OGE_F32));
setLibcallName(RTLIB::OLT_F32, getIntrinsicName(RTLIB::OLT_F32));
setLibcallName(RTLIB::OGT_F32, getIntrinsicName(RTLIB::OGT_F32));
setLibcallName(RTLIB::OEQ_F32, getIntrinsicName(RTLIB::OEQ_F32));
setLibcallName(RTLIB::UNE_F32, getIntrinsicName(RTLIB::UNE_F32));
// Return value comparisons of floating point calls.
setCmpLibcallCC(RTLIB::OEQ_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::UNE_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::OLT_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::OLE_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::OGE_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::OGT_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::UO_F32, ISD::SETNE);
setCmpLibcallCC(RTLIB::O_F32, ISD::SETEQ);
setOperationAction(ISD::GlobalAddress, MVT::i16, Custom);
setOperationAction(ISD::ExternalSymbol, MVT::i16, Custom);