Skip to content

Commit 83b3bab

Browse files
committed
ARM: Move gnu half convert calling conv config into tablegen
1 parent 377c292 commit 83b3bab

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,10 +1482,21 @@ def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
14821482
def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
14831483
def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
14841484

1485+
1486+
// The half <-> float conversion functions are always soft-float on
1487+
// non-watchos platforms, but are needed for some targets which use a
1488+
// hard-float calling convention by default.
1489+
def ARMHalfConvertLibcallCallingConv : LibcallCallingConv<
1490+
[{TT.isWatchABI() ? DefaultCC :
1491+
(isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS)}]
1492+
>;
1493+
14851494
def GNUEABIHalfConvertCalls :
14861495
LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
14871496
RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
1488-
!TT.isTargetAEABI()}]>>;
1497+
!TT.isTargetAEABI()}]>> {
1498+
let CallingConv = ARMHalfConvertLibcallCallingConv;
1499+
}
14891500

14901501
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
14911502
// they have a __gnu_ prefix (which is the default).

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)