Skip to content

Commit f405b4e

Browse files
committed
Add comments for scheme
1 parent f7a31d6 commit f405b4e

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

llvm/lib/CodeGen/TargetLoweringBase.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -604,37 +604,36 @@ RTLIB::Libcall RTLIB::getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize) {
604604
ISD::CondCode TargetLoweringBase::getSoftFloatCmpLibcallPredicate(
605605
RTLIB::LibcallImpl Impl) const {
606606
switch (Impl) {
607-
case RTLIB::__aeabi_dcmpeq__ne:
608-
return ISD::SETNE;
609607
case RTLIB::__aeabi_dcmpeq__eq:
608+
case RTLIB::__aeabi_fcmpeq__eq:
609+
// Usage in the eq case, so we have to invert the comparison.
610610
return ISD::SETEQ;
611-
case RTLIB::__aeabi_dcmplt:
611+
case RTLIB::__aeabi_dcmpeq__ne:
612+
case RTLIB::__aeabi_fcmpeq__ne:
613+
// Normal comparison to boolean value.
612614
return ISD::SETNE;
615+
case RTLIB::__aeabi_dcmplt:
613616
case RTLIB::__aeabi_dcmple:
614-
return ISD::SETNE;
615617
case RTLIB::__aeabi_dcmpge:
616-
return ISD::SETNE;
617618
case RTLIB::__aeabi_dcmpgt:
618-
return ISD::SETNE;
619619
case RTLIB::__aeabi_dcmpun:
620-
return ISD::SETNE;
621-
case RTLIB::__aeabi_fcmpeq__ne:
622-
return ISD::SETNE;
623-
case RTLIB::__aeabi_fcmpeq__eq:
624-
return ISD::SETEQ;
625620
case RTLIB::__aeabi_fcmplt:
626-
return ISD::SETNE;
627621
case RTLIB::__aeabi_fcmple:
628-
return ISD::SETNE;
629622
case RTLIB::__aeabi_fcmpge:
630-
return ISD::SETNE;
631623
case RTLIB::__aeabi_fcmpgt:
624+
/// The AEABI versions return a typical boolean value, so we can compare
625+
/// against the integer result as simply != 0.
632626
return ISD::SETNE;
633627
default:
634628
break;
635629
}
636630

637-
// Assume libgcc/compiler-rt behavior
631+
// Assume libgcc/compiler-rt behavior. Most of the cases are really aliases of
632+
// each other, and return a 3-way comparison style result of -1, 0, or 1
633+
// depending on lt/eq/gt.
634+
//
635+
// FIXME: It would be cleaner to directly express this as a 3-way comparison
636+
// soft FP libcall instead of individual compares.
638637
RTLIB::Libcall LC = RTLIB::RuntimeLibcallsInfo::getLibcallFromImpl(Impl);
639638
switch (LC) {
640639
case RTLIB::OEQ_F32:

0 commit comments

Comments
 (0)