ARM: Remove remaining half convert libcall config into tablegen
The __truncdfhf2 handling is kind of convoluted, but reproduces the existing, likely wrong, handling.
This commit is contained in:
parent
c00b04a7e0
commit
67eb146af0
@ -1576,13 +1576,6 @@ def __aeabi_h2f : RuntimeLibcallImpl<FPEXT_F16_F32>; // CallingConv::ARM_AAPCS
|
||||
def __gnu_f2h_ieee : RuntimeLibcallImpl<FPROUND_F32_F16>;
|
||||
def __gnu_h2f_ieee : RuntimeLibcallImpl<FPEXT_F16_F32>;
|
||||
|
||||
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
|
||||
// they have a __gnu_ prefix (which is the default).
|
||||
def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
|
||||
isTargetAEABIAndAAPCS_ABI> {
|
||||
let CallingConv = ARM_AAPCS;
|
||||
}
|
||||
|
||||
// The half <-> float conversion functions are always soft-float on
|
||||
// non-watchos platforms, but are needed for some targets which use a
|
||||
// hard-float calling convention by default.
|
||||
@ -1591,6 +1584,27 @@ def ARMHalfConvertLibcallCallingConv : LibcallCallingConv<
|
||||
(isAAPCS_ABI(TT, ABIName) ? CallingConv::ARM_AAPCS : CallingConv::ARM_APCS)}]
|
||||
>;
|
||||
|
||||
def ARMLibgccHalfConvertCalls :
|
||||
LibcallImpls<(add __truncsfhf2, __extendhfsf2),
|
||||
RuntimeLibcallPredicate<[{!TT.isTargetAEABI() && TT.isOSBinFormatMachO()}]>> {
|
||||
let CallingConv = ARMHalfConvertLibcallCallingConv;
|
||||
}
|
||||
|
||||
// FIXME: These conditions are probably bugged. We're using the
|
||||
// default libgcc call when the other cases are replaced.
|
||||
def ARMDoubleToHalfCalls :
|
||||
LibcallImpls<(add __truncdfhf2),
|
||||
RuntimeLibcallPredicate<[{!TT.isTargetAEABI()}]>> {
|
||||
let CallingConv = ARMHalfConvertLibcallCallingConv;
|
||||
}
|
||||
|
||||
// In EABI, these functions have an __aeabi_ prefix, but in GNUEABI
|
||||
// they have a __gnu_ prefix (which is the default).
|
||||
def EABIHalfConvertCalls : LibcallImpls<(add __aeabi_f2h, __aeabi_h2f),
|
||||
isTargetAEABIAndAAPCS_ABI> {
|
||||
let CallingConv = ARM_AAPCS;
|
||||
}
|
||||
|
||||
def GNUEABIHalfConvertCalls :
|
||||
LibcallImpls<(add __gnu_f2h_ieee, __gnu_h2f_ieee),
|
||||
RuntimeLibcallPredicate<[{!TT.isOSBinFormatMachO() &&
|
||||
@ -1717,7 +1731,9 @@ def isARMOrThumb : RuntimeLibcallPredicate<"TT.isARM() || TT.isThumb()">;
|
||||
|
||||
def ARMSystemLibrary
|
||||
: SystemRuntimeLibrary<isARMOrThumb,
|
||||
(add WinDefaultLibcallImpls,
|
||||
(add (sub WinDefaultLibcallImpls, ARMLibgccHalfConvertCalls,
|
||||
GNUEABIHalfConvertCalls,
|
||||
ARMDoubleToHalfCalls),
|
||||
LibcallImpls<(add __powisf2, __powidf2), isNotOSMSVCRT>,
|
||||
LibmHasFrexpF32, LibmHasLdexpF32,
|
||||
LibmHasFrexpF128, LibmHasLdexpF128,
|
||||
@ -1731,8 +1747,10 @@ def ARMSystemLibrary
|
||||
|
||||
AEABICalls,
|
||||
AEABI45MemCalls,
|
||||
ARMLibgccHalfConvertCalls,
|
||||
EABIHalfConvertCalls,
|
||||
GNUEABIHalfConvertCalls,
|
||||
ARMDoubleToHalfCalls,
|
||||
|
||||
// Use divmod compiler-rt calls for iOS 5.0 and later.
|
||||
LibcallImpls<(add __divmodsi4, __udivmodsi4),
|
||||
|
||||
@ -33,25 +33,6 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
|
||||
EABI EABIVersion, StringRef ABIName) {
|
||||
setTargetRuntimeLibcallSets(TT, ExceptionModel, FloatABI, EABIVersion,
|
||||
ABIName);
|
||||
|
||||
if (TT.isARM() || TT.isThumb()) {
|
||||
// The half <-> float conversion functions are always soft-float on
|
||||
// non-watchos platforms, but are needed for some targets which use a
|
||||
// hard-float calling convention by default.
|
||||
if (!TT.isWatchABI()) {
|
||||
if (isAAPCS_ABI(TT, ABIName)) {
|
||||
setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_AAPCS);
|
||||
setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_AAPCS);
|
||||
setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_AAPCS);
|
||||
} else {
|
||||
setLibcallImplCallingConv(RTLIB::__truncsfhf2, CallingConv::ARM_APCS);
|
||||
setLibcallImplCallingConv(RTLIB::__truncdfhf2, CallingConv::ARM_APCS);
|
||||
setLibcallImplCallingConv(RTLIB::__extendhfsf2, CallingConv::ARM_APCS);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user