@@ -1280,6 +1280,9 @@ def AMDGPUSystemLibrary : SystemRuntimeLibrary<isAMDGPU, (add)>;
12801280// ARM Runtime Libcalls
12811281//===----------------------------------------------------------------------===//
12821282
1283+ def isTargetAEABIAndAAPCS_ABI : RuntimeLibcallPredicate<
1284+ [{TT.isTargetAEABI() && isAAPCS_ABI(TT, ABIName)}]>;
1285+
12831286// if (isTargetMachO()) {
12841287// if (Subtarget->isThumb() && Subtarget->hasVFP2Base() &&
12851288// Subtarget->hasARMOps() && !Subtarget->useSoftFloat()) {
@@ -1473,13 +1476,23 @@ def __udivmodsi4 : RuntimeLibcallImpl<UDIVREM_I32>;
14731476// a __gnu_ prefix (which is the default).
14741477// isTargetAEABI()
14751478def __aeabi_f2h : RuntimeLibcallImpl<FPROUND_F32_F16>; // CallingConv::ARM_AAPCS
1476- //def __aeabi_d2h : RuntimeLibcallImpl<FPROUND_F64_F16>; // CallingConv::ARM_AAPCS
14771479def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
14781480
14791481// !isTargetMachO()
14801482def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
14811483def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
14821484
1485+ def GNUEABIHalfConvertCalls :
1486+ LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
1487+ RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
1488+ !TT.isTargetAEABI()}]>>;
1489+
1490+ // In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
1491+ // they have a __gnu_ prefix (which is the default).
1492+ def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
1493+ isTargetAEABIAndAAPCS_ABI> {
1494+ let CallingConv = ARM_AAPCS;
1495+ }
14831496
14841497def WindowARMDivRemCalls : LibcallImpls<
14851498 (add __rt_sdiv, __rt_sdiv64, __rt_udiv, __rt_udiv64),
@@ -1553,8 +1566,8 @@ def AEABICalls : LibcallImpls<
15531566 // RTABI chapter 4.1.2, Table 7
15541567 __aeabi_d2f,
15551568 __aeabi_f2d,
1556- __aeabi_h2f,
1557- __aeabi_f2h,
1569+ // __aeabi_h2f added separately
1570+ // __aeabi_f2h added separately
15581571 __aeabi_d2h,
15591572
15601573 // Integer to floating-point conversions.
@@ -1614,6 +1627,8 @@ def ARMSystemLibrary
16141627
16151628 AEABICalls,
16161629 AEABI45MemCalls,
1630+ EABIHalfConvertCalls,
1631+ GNUEABIHalfConvertCalls,
16171632
16181633 // Use divmod compiler-rt calls for iOS 5.0 and later.
16191634 LibcallImpls<(add __divmodsi4, __udivmodsi4),
0 commit comments