Skip to content

Commit 3968c83

Browse files
committed
Add comments for scheme
1 parent 4b44740 commit 3968c83

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
@@ -612,37 +612,36 @@ RTLIB::Libcall RTLIB::getMEMSET_ELEMENT_UNORDERED_ATOMIC(uint64_t ElementSize) {
612612
ISD::CondCode TargetLoweringBase::getSoftFloatCmpLibcallPredicate(
613613
RTLIB::LibcallImpl Impl) const {
614614
switch (Impl) {
615-
case RTLIB::__aeabi_dcmpeq__ne:
616-
return ISD::SETNE;
617615
case RTLIB::__aeabi_dcmpeq__eq:
616+
case RTLIB::__aeabi_fcmpeq__eq:
617+
// Usage in the eq case, so we have to invert the comparison.
618618
return ISD::SETEQ;
619-
case RTLIB::__aeabi_dcmplt:
619+
case RTLIB::__aeabi_dcmpeq__ne:
620+
case RTLIB::__aeabi_fcmpeq__ne:
621+
// Normal comparison to boolean value.
620622
return ISD::SETNE;
623+
case RTLIB::__aeabi_dcmplt:
621624
case RTLIB::__aeabi_dcmple:
622-
return ISD::SETNE;
623625
case RTLIB::__aeabi_dcmpge:
624-
return ISD::SETNE;
625626
case RTLIB::__aeabi_dcmpgt:
626-
return ISD::SETNE;
627627
case RTLIB::__aeabi_dcmpun:
628-
return ISD::SETNE;
629-
case RTLIB::__aeabi_fcmpeq__ne:
630-
return ISD::SETNE;
631-
case RTLIB::__aeabi_fcmpeq__eq:
632-
return ISD::SETEQ;
633628
case RTLIB::__aeabi_fcmplt:
634-
return ISD::SETNE;
635629
case RTLIB::__aeabi_fcmple:
636-
return ISD::SETNE;
637630
case RTLIB::__aeabi_fcmpge:
638-
return ISD::SETNE;
639631
case RTLIB::__aeabi_fcmpgt:
632+
/// The AEABI versions return a typical boolean value, so we can compare
633+
/// against the integer result as simply != 0.
640634
return ISD::SETNE;
641635
default:
642636
break;
643637
}
644638

645-
// Assume libgcc/compiler-rt behavior
639+
// Assume libgcc/compiler-rt behavior. Most of the cases are really aliases of
640+
// each other, and return a 3-way comparison style result of -1, 0, or 1
641+
// depending on lt/eq/gt.
642+
//
643+
// FIXME: It would be cleaner to directly express this as a 3-way comparison
644+
// soft FP libcall instead of individual compares.
646645
RTLIB::Libcall LC = RTLIB::RuntimeLibcallsInfo::getLibcallFromImpl(Impl);
647646
switch (LC) {
648647
case RTLIB::OEQ_F32:

0 commit comments

Comments
 (0)