Skip to content

Commit cdacf6e

Browse files
committed
ARM: Move half convert libcall config to tablegen
1 parent 3c5064e commit cdacf6e

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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()
15161519
def __aeabi_f2h : RuntimeLibcallImpl<FPROUND_F32_F16>; // CallingConv::ARM_AAPCS
1517-
//def __aeabi_d2h : RuntimeLibcallImpl<FPROUND_F64_F16>; // CallingConv::ARM_AAPCS
15181520
def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
15191521

15201522
// !isTargetMachO()
15211523
def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
15221524
def __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

15251538
def 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),

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -587,28 +587,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
587587
}
588588
}
589589

590-
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI they have
591-
// a __gnu_ prefix (which is the default).
592-
if (TT.isTargetAEABI()) {
593-
// FIXME: This does not depend on the subtarget and should go directly into
594-
// RuntimeLibcalls. This is only here because of missing support for setting
595-
// the calling convention of an implementation.
596-
static const struct {
597-
const RTLIB::Libcall Op;
598-
const RTLIB::LibcallImpl Impl;
599-
} LibraryCalls[] = {
600-
{RTLIB::FPROUND_F32_F16, RTLIB::__aeabi_f2h},
601-
{RTLIB::FPEXT_F16_F32, RTLIB::__aeabi_h2f},
602-
};
603-
604-
for (const auto &LC : LibraryCalls) {
605-
setLibcallImpl(LC.Op, LC.Impl);
606-
}
607-
} else if (!TT.isOSBinFormatMachO()) {
608-
setLibcallImpl(RTLIB::FPROUND_F32_F16, RTLIB::__gnu_f2h_ieee);
609-
setLibcallImpl(RTLIB::FPEXT_F16_F32, RTLIB::__gnu_h2f_ieee);
610-
}
611-
612590
if (Subtarget->isThumb1Only())
613591
addRegisterClass(MVT::i32, &ARM::tGPRRegClass);
614592
else

0 commit comments

Comments
 (0)