@@ -62,69 +62,6 @@ static void setARMLibcallNames(RuntimeLibcallsInfo &Info, const Triple &TT,
6262 Info.setLibcallImplCallingConv (Impl, CallingConv::ARM_AAPCS);
6363}
6464
65- static void setLongDoubleIsF128Libm (RuntimeLibcallsInfo &Info,
66- bool FiniteOnlyFuncs = false ) {
67- Info.setLibcallImpl (RTLIB::REM_F128, RTLIB::fmodf128);
68- Info.setLibcallImpl (RTLIB::FMA_F128, RTLIB::fmaf128);
69- Info.setLibcallImpl (RTLIB::SQRT_F128, RTLIB::sqrtf128);
70- Info.setLibcallImpl (RTLIB::CBRT_F128, RTLIB::cbrtf128);
71- Info.setLibcallImpl (RTLIB::LOG_F128, RTLIB::logf128);
72- Info.setLibcallImpl (RTLIB::LOG2_F128, RTLIB::log2f128);
73- Info.setLibcallImpl (RTLIB::LOG10_F128, RTLIB::log10f128);
74- Info.setLibcallImpl (RTLIB::EXP_F128, RTLIB::expf128);
75- Info.setLibcallImpl (RTLIB::EXP2_F128, RTLIB::exp2f128);
76- Info.setLibcallImpl (RTLIB::EXP10_F128, RTLIB::exp10f128);
77- Info.setLibcallImpl (RTLIB::SIN_F128, RTLIB::sinf128);
78- Info.setLibcallImpl (RTLIB::COS_F128, RTLIB::cosf128);
79- Info.setLibcallImpl (RTLIB::TAN_F128, RTLIB::tanf128);
80- Info.setLibcallImpl (RTLIB::SINCOS_F128, RTLIB::sincosf128);
81- Info.setLibcallImpl (RTLIB::ASIN_F128, RTLIB::asinf128);
82- Info.setLibcallImpl (RTLIB::ACOS_F128, RTLIB::acosf128);
83- Info.setLibcallImpl (RTLIB::ATAN_F128, RTLIB::atanf128);
84- Info.setLibcallImpl (RTLIB::ATAN2_F128, RTLIB::atan2f128);
85- Info.setLibcallImpl (RTLIB::SINH_F128, RTLIB::sinhf128);
86- Info.setLibcallImpl (RTLIB::COSH_F128, RTLIB::coshf128);
87- Info.setLibcallImpl (RTLIB::TANH_F128, RTLIB::tanhf128);
88- Info.setLibcallImpl (RTLIB::POW_F128, RTLIB::powf128);
89- Info.setLibcallImpl (RTLIB::CEIL_F128, RTLIB::ceilf128);
90- Info.setLibcallImpl (RTLIB::TRUNC_F128, RTLIB::truncf128);
91- Info.setLibcallImpl (RTLIB::RINT_F128, RTLIB::rintf128);
92- Info.setLibcallImpl (RTLIB::NEARBYINT_F128, RTLIB::nearbyintf128);
93- Info.setLibcallImpl (RTLIB::ROUND_F128, RTLIB::roundf128);
94- Info.setLibcallImpl (RTLIB::ROUNDEVEN_F128, RTLIB::roundevenf128);
95- Info.setLibcallImpl (RTLIB::FLOOR_F128, RTLIB::floorf128);
96- Info.setLibcallImpl (RTLIB::COPYSIGN_F128, RTLIB::copysignf128);
97- Info.setLibcallImpl (RTLIB::FMIN_F128, RTLIB::fminf128);
98- Info.setLibcallImpl (RTLIB::FMAX_F128, RTLIB::fmaxf128);
99- Info.setLibcallImpl (RTLIB::FMINIMUM_F128, RTLIB::fminimumf128);
100- Info.setLibcallImpl (RTLIB::FMAXIMUM_F128, RTLIB::fmaximumf128);
101- Info.setLibcallImpl (RTLIB::FMINIMUM_NUM_F128, RTLIB::fminimum_numf128);
102- Info.setLibcallImpl (RTLIB::FMAXIMUM_NUM_F128, RTLIB::fmaximum_numf128);
103- Info.setLibcallImpl (RTLIB::LROUND_F128, RTLIB::lroundf128);
104- Info.setLibcallImpl (RTLIB::LLROUND_F128, RTLIB::llroundf128);
105- Info.setLibcallImpl (RTLIB::LRINT_F128, RTLIB::lrintf128);
106- Info.setLibcallImpl (RTLIB::LLRINT_F128, RTLIB::llrintf128);
107- Info.setLibcallImpl (RTLIB::LDEXP_F128, RTLIB::ldexpf128);
108- Info.setLibcallImpl (RTLIB::FREXP_F128, RTLIB::frexpf128);
109- Info.setLibcallImpl (RTLIB::MODF_F128, RTLIB::modff128);
110-
111- if (FiniteOnlyFuncs) {
112- Info.setLibcallImpl (RTLIB::LOG_FINITE_F128, RTLIB::__logf128_finite);
113- Info.setLibcallImpl (RTLIB::LOG2_FINITE_F128, RTLIB::__log2f128_finite);
114- Info.setLibcallImpl (RTLIB::LOG10_FINITE_F128, RTLIB::__log10f128_finite);
115- Info.setLibcallImpl (RTLIB::EXP_FINITE_F128, RTLIB::__expf128_finite);
116- Info.setLibcallImpl (RTLIB::EXP2_FINITE_F128, RTLIB::__exp2f128_finite);
117- Info.setLibcallImpl (RTLIB::POW_FINITE_F128, RTLIB::__powf128_finite);
118- } else {
119- Info.setLibcallImpl (RTLIB::LOG_FINITE_F128, RTLIB::Unsupported);
120- Info.setLibcallImpl (RTLIB::LOG2_FINITE_F128, RTLIB::Unsupported);
121- Info.setLibcallImpl (RTLIB::LOG10_FINITE_F128, RTLIB::Unsupported);
122- Info.setLibcallImpl (RTLIB::EXP_FINITE_F128, RTLIB::Unsupported);
123- Info.setLibcallImpl (RTLIB::EXP2_FINITE_F128, RTLIB::Unsupported);
124- Info.setLibcallImpl (RTLIB::POW_FINITE_F128, RTLIB::Unsupported);
125- }
126- }
127-
12865void RTLIB::RuntimeLibcallsInfo::initDefaultLibCallImpls () {
12966 std::memcpy (LibcallImpls, DefaultLibcallImpls, sizeof (LibcallImpls));
13067 static_assert (sizeof (LibcallImpls) == sizeof (DefaultLibcallImpls),
@@ -143,10 +80,6 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
14380 if (TT.isAMDGPU () || TT.isNVPTX () || TT.isWasm ())
14481 return ;
14582
146- // Use the f128 variants of math functions on x86
147- if (TT.isX86 () && TT.isGNUEnvironment ())
148- setLongDoubleIsF128Libm (*this , /* FiniteOnlyFuncs=*/ true );
149-
15083 if (TT.isX86 () || TT.isVE () || TT.isARM () || TT.isThumb ()) {
15184 if (ExceptionModel == ExceptionHandling::SjLj)
15285 setLibcallImpl (RTLIB::UNWIND_RESUME, RTLIB::_Unwind_SjLj_Resume);
@@ -160,91 +93,40 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
16093 setLibcallImpl (RTLIB::FPEXT_F16_F32, RTLIB::__extendhfsf2);
16194 setLibcallImpl (RTLIB::FPROUND_F32_F16, RTLIB::__truncsfhf2);
16295
163- // Some darwins have an optimized __bzero/bzero function.
164- if (TT.isX86 ()) {
165- if (TT.isMacOSX () && !TT.isMacOSXVersionLT (10 , 6 ))
166- setLibcallImpl (RTLIB::BZERO, RTLIB::__bzero);
167- }
168-
169- if (darwinHasSinCosStret (TT)) {
170- setLibcallImpl (RTLIB::SINCOS_STRET_F32, RTLIB::__sincosf_stret);
171- setLibcallImpl (RTLIB::SINCOS_STRET_F64, RTLIB::__sincos_stret);
172- if (TT.isWatchABI ()) {
173- setLibcallImplCallingConv (RTLIB::__sincosf_stret,
174- CallingConv::ARM_AAPCS_VFP);
175- setLibcallImplCallingConv (RTLIB::__sincos_stret,
176- CallingConv::ARM_AAPCS_VFP);
177- }
96+ if (TT.isWatchABI ()) {
97+ setLibcallImplCallingConv (RTLIB::__sincosf_stret,
98+ CallingConv::ARM_AAPCS_VFP);
99+ setLibcallImplCallingConv (RTLIB::__sincos_stret,
100+ CallingConv::ARM_AAPCS_VFP);
178101 }
179102
180- if (darwinHasExp10 (TT)) {
181- setLibcallImpl (RTLIB::EXP10_F32, RTLIB::__exp10f);
182- setLibcallImpl (RTLIB::EXP10_F64, RTLIB::__exp10);
183- } else {
103+ if (!darwinHasExp10 (TT)) {
104+ // FIXME: Remove exp10 from default set
184105 setLibcallImpl (RTLIB::EXP10_F32, RTLIB::Unsupported);
185106 setLibcallImpl (RTLIB::EXP10_F64, RTLIB::Unsupported);
186107 }
187108 }
188109
189- if (hasSinCos (TT)) {
190- setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
191- setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
192- setLibcallImpl (RTLIB::SINCOS_F80, RTLIB::sincos_f80);
193- setLibcallImpl (RTLIB::SINCOS_F128, RTLIB::sincos_f128);
194- setLibcallImpl (RTLIB::SINCOS_PPCF128, RTLIB::sincos_ppcf128);
195- }
196-
197- if (TT.isPS ()) {
198- setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
199- setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
200- }
201-
202110 if (TT.isOSOpenBSD ()) {
203111 setLibcallImpl (RTLIB::STACKPROTECTOR_CHECK_FAIL, RTLIB::Unsupported);
204112 }
205113
206- if (TT.isOSWindows () && !TT.isOSCygMing ()) {
207- setLibcallImpl (RTLIB::LDEXP_F32, RTLIB::Unsupported);
208- setLibcallImpl (RTLIB::LDEXP_F80, RTLIB::Unsupported);
209- setLibcallImpl (RTLIB::LDEXP_F128, RTLIB::Unsupported);
210- setLibcallImpl (RTLIB::LDEXP_PPCF128, RTLIB::Unsupported);
211-
212- setLibcallImpl (RTLIB::FREXP_F32, RTLIB::Unsupported);
213- setLibcallImpl (RTLIB::FREXP_F80, RTLIB::Unsupported);
214- setLibcallImpl (RTLIB::FREXP_F128, RTLIB::Unsupported);
215- setLibcallImpl (RTLIB::FREXP_PPCF128, RTLIB::Unsupported);
216- }
114+ // Skip default manual processing for targets that have been fully ported to
115+ // tablegen for now. Eventually the rest of this should be deleted.
116+ if (TT.isX86 () || TT.isAArch64 () || TT.isWasm ())
117+ return ;
217118
218- if (TT.isOSMSVCRT ()) {
219- // MSVCRT doesn't have powi; fall back to pow
220- setLibcallImpl (RTLIB::POWI_F32, RTLIB::Unsupported);
221- setLibcallImpl (RTLIB::POWI_F64, RTLIB::Unsupported);
119+ if (TT.isARM () || TT.isThumb ()) {
120+ setARMLibcallNames (*this , TT, FloatABI, EABIVersion);
121+ return ;
222122 }
223123
224- // Setup Windows compiler runtime calls.
225- if (TT.getArch () == Triple::x86 &&
226- (TT.isWindowsMSVCEnvironment () || TT.isWindowsItaniumEnvironment ())) {
227- static const struct {
228- const RTLIB::Libcall Op;
229- const RTLIB::LibcallImpl Impl;
230- const CallingConv::ID CC;
231- } LibraryCalls[] = {
232- {RTLIB::SDIV_I64, RTLIB::_alldiv, CallingConv::X86_StdCall},
233- {RTLIB::UDIV_I64, RTLIB::_aulldiv, CallingConv::X86_StdCall},
234- {RTLIB::SREM_I64, RTLIB::_allrem, CallingConv::X86_StdCall},
235- {RTLIB::UREM_I64, RTLIB::_aullrem, CallingConv::X86_StdCall},
236- {RTLIB::MUL_I64, RTLIB::_allmul, CallingConv::X86_StdCall},
237- };
238-
239- for (const auto &LC : LibraryCalls) {
240- setLibcallImpl (LC.Op , LC.Impl );
241- setLibcallImplCallingConv (LC.Impl , LC.CC );
242- }
124+ if (hasSinCos (TT)) {
125+ setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
126+ setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
127+ setLibcallImpl (RTLIB::SINCOS_F128, RTLIB::sincos_f128);
243128 }
244129
245- if (TT.isARM () || TT.isThumb ())
246- setARMLibcallNames (*this , TT, FloatABI, EABIVersion);
247-
248130 // These libcalls are only available in compiler-rt, not libgcc.
249131 if (TT.isArch64Bit ()) {
250132 setLibcallImpl (RTLIB::SHL_I128, RTLIB::__ashlti3);
0 commit comments