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