@@ -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,85 +93,32 @@ 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- }
173-
174- if (darwinHasExp10 (TT)) {
175- setLibcallImpl (RTLIB::EXP10_F32, RTLIB::__exp10f);
176- setLibcallImpl (RTLIB::EXP10_F64, RTLIB::__exp10);
177- } else {
96+ if (!darwinHasExp10 (TT)) {
17897 setLibcallImpl (RTLIB::EXP10_F32, RTLIB::Unsupported);
17998 setLibcallImpl (RTLIB::EXP10_F64, RTLIB::Unsupported);
18099 }
181100 }
182101
183- if (hasSinCos (TT)) {
184- setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
185- setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
186- setLibcallImpl (RTLIB::SINCOS_F80, RTLIB::sincos_f80);
187- setLibcallImpl (RTLIB::SINCOS_F128, RTLIB::sincos_f128);
188- setLibcallImpl (RTLIB::SINCOS_PPCF128, RTLIB::sincos_ppcf128);
189- }
190-
191- if (TT.isPS ()) {
192- setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
193- setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
194- }
195-
196102 if (TT.isOSOpenBSD ()) {
197103 setLibcallImpl (RTLIB::STACKPROTECTOR_CHECK_FAIL, RTLIB::Unsupported);
198104 }
199105
200- if (TT.isOSWindows () && !TT.isOSCygMing ()) {
201- setLibcallImpl (RTLIB::LDEXP_F32, RTLIB::Unsupported);
202- setLibcallImpl (RTLIB::LDEXP_F80, RTLIB::Unsupported);
203- setLibcallImpl (RTLIB::LDEXP_F128, RTLIB::Unsupported);
204- setLibcallImpl (RTLIB::LDEXP_PPCF128, RTLIB::Unsupported);
205-
206- setLibcallImpl (RTLIB::FREXP_F32, RTLIB::Unsupported);
207- setLibcallImpl (RTLIB::FREXP_F80, RTLIB::Unsupported);
208- setLibcallImpl (RTLIB::FREXP_F128, RTLIB::Unsupported);
209- setLibcallImpl (RTLIB::FREXP_PPCF128, RTLIB::Unsupported);
210- }
106+ // Skip default manual processing for targets that have been fully ported to
107+ // tablegen for now. Eventually the rest of this should be deleted.
108+ if (TT.isX86 () || TT.isAArch64 () || TT.isWasm ())
109+ return ;
211110
212- if (TT.isOSMSVCRT ()) {
213- // MSVCRT doesn't have powi; fall back to pow
214- setLibcallImpl (RTLIB::POWI_F32, RTLIB::Unsupported);
215- setLibcallImpl (RTLIB::POWI_F64, RTLIB::Unsupported);
111+ if (TT.isARM () || TT.isThumb ()) {
112+ setARMLibcallNames (*this , TT, FloatABI, EABIVersion);
113+ return ;
216114 }
217115
218- // Setup Windows compiler runtime calls.
219- if (TT.getArch () == Triple::x86 &&
220- (TT.isWindowsMSVCEnvironment () || TT.isWindowsItaniumEnvironment ())) {
221- static const struct {
222- const RTLIB::Libcall Op;
223- const RTLIB::LibcallImpl Impl;
224- const CallingConv::ID CC;
225- } LibraryCalls[] = {
226- {RTLIB::SDIV_I64, RTLIB::_alldiv, CallingConv::X86_StdCall},
227- {RTLIB::UDIV_I64, RTLIB::_aulldiv, CallingConv::X86_StdCall},
228- {RTLIB::SREM_I64, RTLIB::_allrem, CallingConv::X86_StdCall},
229- {RTLIB::UREM_I64, RTLIB::_aullrem, CallingConv::X86_StdCall},
230- {RTLIB::MUL_I64, RTLIB::_allmul, CallingConv::X86_StdCall},
231- };
232-
233- for (const auto &LC : LibraryCalls) {
234- setLibcallImpl (LC.Op , LC.Impl );
235- setLibcallImplCallingConv (LC.Impl , LC.CC );
236- }
116+ if (hasSinCos (TT)) {
117+ setLibcallImpl (RTLIB::SINCOS_F32, RTLIB::sincosf);
118+ setLibcallImpl (RTLIB::SINCOS_F64, RTLIB::sincos);
119+ setLibcallImpl (RTLIB::SINCOS_F128, RTLIB::sincos_f128);
237120 }
238121
239- if (TT.isARM () || TT.isThumb ())
240- setARMLibcallNames (*this , TT, FloatABI, EABIVersion);
241-
242122 // These libcalls are only available in compiler-rt, not libgcc.
243123 if (TT.isArch64Bit ()) {
244124 setLibcallImpl (RTLIB::SHL_I128, RTLIB::__ashlti3);
0 commit comments