Skip to content

Commit 283d03d

Browse files
committed
ARM: Move gnu half convert calling conv config into tablegen
1 parent cdacf6e commit 283d03d

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
@@ -1523,10 +1523,21 @@ def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
15231523
def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
15241524
def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
15251525

1526+
1527+
// The half <-> float conversion functions are always soft-float on
1528+
// non-watchos platforms, but are needed for some targets which use a
1529+
// hard-float calling convention by default.
1530+
def ARMHalfConvertLibcallCallingConv : LibcallCallingConv<
1531+
[{TT.isWatchABI() ? DefaultCC :
1532+
(isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS)}]
1533+
>;
1534+
15261535
def GNUEABIHalfConvertCalls :
15271536
LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
15281537
RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
1529-
!TT.isTargetAEABI()}]>>;
1538+
!TT.isTargetAEABI()}]>> {
1539+
let CallingConv = ARMHalfConvertLibcallCallingConv;
1540+
}
15301541

15311542
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
15321543
// 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)