Skip to content

Commit ddb2dc5

Browse files
authored
ARM: Move gnu half convert calling conv config into tablegen (#153394)
1 parent 4aae7bc commit ddb2dc5

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,28 @@ def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
14941494
let CallingConv = ARM_AAPCS;
14951495
}
14961496

1497+
// The half <-> float conversion functions are always soft-float on
1498+
// non-watchos platforms, but are needed for some targets which use a
1499+
// hard-float calling convention by default.
1500+
def ARMHalfConvertLibcallCallingConv : LibcallCallingConv<
1501+
[{TT.isWatchABI() ? DefaultCC :
1502+
(isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS)}]
1503+
>;
1504+
1505+
def GNUEABIHalfConvertCalls :
1506+
LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
1507+
RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
1508+
!TT.isTargetAEABI()}]>> {
1509+
let CallingConv = ARMHalfConvertLibcallCallingConv;
1510+
}
1511+
1512+
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
1513+
// they have a __gnu_ prefix (which is the default).
1514+
def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
1515+
isTargetAEABIAndAAPCS_ABI> {
1516+
let CallingConv = ARM_AAPCS;
1517+
}
1518+
14971519
def WindowARMDivRemCalls : LibcallImpls<
14981520
(add __rt_sdiv, __rt_sdiv64, __rt_udiv, __rt_udiv64),
14991521
isOSWindows> {

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,10 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
4242
setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_AAPCS);
4343
setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_AAPCS);
4444
setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_AAPCS);
45-
setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee,
46-
CallingConv::ARM_AAPCS);
47-
setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee,
48-
CallingConv::ARM_AAPCS);
4945
} else {
5046
setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_APCS);
5147
setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_APCS);
5248
setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_APCS);
53-
setLibcallImplCallingConv(RTLIB::__gnu_h2f_ieee, CallingConv::ARM_APCS);
54-
setLibcallImplCallingConv(RTLIB::__gnu_f2h_ieee, CallingConv::ARM_APCS);
5549
}
5650
}
5751

0 commit comments

Comments
 (0)