@@ -1321,6 +1321,9 @@ def AMDGPUSystemLibrary : SystemRuntimeLibrary<isAMDGPU, (add)>;
13211321// ARM Runtime Libcalls
13221322//===----------------------------------------------------------------------===//
13231323
1324+ def isTargetAEABIAndAAPCS_ABI : RuntimeLibcallPredicate<
1325+ [{TT.isTargetAEABI() && isAAPCS_ABI(TT, ABIName)}]>;
1326+
13241327// if (isTargetMachO()) {
13251328// if (Subtarget->isThumb() && Subtarget->hasVFP2Base() &&
13261329// Subtarget->hasARMOps() && !Subtarget->useSoftFloat()) {
@@ -1514,13 +1517,23 @@ def __udivmodsi4 : RuntimeLibcallImpl<UDIVREM_I32>;
15141517// a __gnu_ prefix (which is the default).
15151518// isTargetAEABI()
15161519def __aeabi_f2h : RuntimeLibcallImpl<FPROUND_F32_F16>; // CallingConv::ARM_AAPCS
1517- //def __aeabi_d2h : RuntimeLibcallImpl<FPROUND_F64_F16>; // CallingConv::ARM_AAPCS
15181520def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
15191521
15201522// !isTargetMachO()
15211523def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
15221524def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
15231525
1526+ def GNUEABIHalfConvertCalls :
1527+ LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
1528+ RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
1529+ !TT.isTargetAEABI()}]>>;
1530+
1531+ // In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
1532+ // they have a __gnu_ prefix (which is the default).
1533+ def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
1534+ isTargetAEABIAndAAPCS_ABI> {
1535+ let CallingConv = ARM_AAPCS;
1536+ }
15241537
15251538def WindowARMDivRemCalls : LibcallImpls<
15261539 (add __rt_sdiv, __rt_sdiv64, __rt_udiv, __rt_udiv64),
@@ -1594,8 +1607,8 @@ def AEABICalls : LibcallImpls<
15941607 // RTABI chapter 4.1.2, Table 7
15951608 __aeabi_d2f,
15961609 __aeabi_f2d,
1597- __aeabi_h2f,
1598- __aeabi_f2h,
1610+ // __aeabi_h2f added separately
1611+ // __aeabi_f2h added separately
15991612 __aeabi_d2h,
16001613
16011614 // Integer to floating-point conversions.
@@ -1655,6 +1668,8 @@ def ARMSystemLibrary
16551668
16561669 AEABICalls,
16571670 AEABI45MemCalls,
1671+ EABIHalfConvertCalls,
1672+ GNUEABIHalfConvertCalls,
16581673
16591674 // Use divmod compiler-rt calls for iOS 5.0 and later.
16601675 LibcallImpls<(add __divmodsi4, __udivmodsi4),
0 commit comments