@@ -281,6 +281,69 @@ void RuntimeLibcallsInfo::initSoftFloatCmpLibcallPredicates() {
281
281
SoftFloatCompareLibcallPredicates[RTLIB::UO_PPCF128] = CmpInst::ICMP_NE;
282
282
}
283
283
284
+ static void setLongDoubleIsF128Libm (RuntimeLibcallsInfo &Info,
285
+ bool FiniteOnlyFuncs = false ) {
286
+ Info.setLibcallName (RTLIB::REM_F128, " fmodf128" );
287
+ Info.setLibcallName (RTLIB::FMA_F128, " fmaf128" );
288
+ Info.setLibcallName (RTLIB::SQRT_F128, " sqrtf128" );
289
+ Info.setLibcallName (RTLIB::CBRT_F128, " cbrtf128" );
290
+ Info.setLibcallName (RTLIB::LOG_F128, " logf128" );
291
+ Info.setLibcallName (RTLIB::LOG2_F128, " log2f128" );
292
+ Info.setLibcallName (RTLIB::LOG10_F128, " log10f128" );
293
+ Info.setLibcallName (RTLIB::EXP_F128, " expf128" );
294
+ Info.setLibcallName (RTLIB::EXP2_F128, " exp2f128" );
295
+ Info.setLibcallName (RTLIB::EXP10_F128, " exp10f128" );
296
+ Info.setLibcallName (RTLIB::SIN_F128, " sinf128" );
297
+ Info.setLibcallName (RTLIB::COS_F128, " cosf128" );
298
+ Info.setLibcallName (RTLIB::TAN_F128, " tanf128" );
299
+ Info.setLibcallName (RTLIB::SINCOS_F128, " sincosf128" );
300
+ Info.setLibcallName (RTLIB::ASIN_F128, " asinf128" );
301
+ Info.setLibcallName (RTLIB::ACOS_F128, " acosf128" );
302
+ Info.setLibcallName (RTLIB::ATAN_F128, " atanf128" );
303
+ Info.setLibcallName (RTLIB::ATAN2_F128, " atan2f128" );
304
+ Info.setLibcallName (RTLIB::SINH_F128, " sinhf128" );
305
+ Info.setLibcallName (RTLIB::COSH_F128, " coshf128" );
306
+ Info.setLibcallName (RTLIB::TANH_F128, " tanhf128" );
307
+ Info.setLibcallName (RTLIB::POW_F128, " powf128" );
308
+ Info.setLibcallName (RTLIB::CEIL_F128, " ceilf128" );
309
+ Info.setLibcallName (RTLIB::TRUNC_F128, " truncf128" );
310
+ Info.setLibcallName (RTLIB::RINT_F128, " rintf128" );
311
+ Info.setLibcallName (RTLIB::NEARBYINT_F128, " nearbyintf128" );
312
+ Info.setLibcallName (RTLIB::ROUND_F128, " roundf128" );
313
+ Info.setLibcallName (RTLIB::ROUNDEVEN_F128, " roundevenf128" );
314
+ Info.setLibcallName (RTLIB::FLOOR_F128, " floorf128" );
315
+ Info.setLibcallName (RTLIB::COPYSIGN_F128, " copysignf128" );
316
+ Info.setLibcallName (RTLIB::FMIN_F128, " fminf128" );
317
+ Info.setLibcallName (RTLIB::FMAX_F128, " fmaxf128" );
318
+ Info.setLibcallName (RTLIB::FMINIMUM_F128, " fminimumf128" );
319
+ Info.setLibcallName (RTLIB::FMAXIMUM_F128, " fmaximumf128" );
320
+ Info.setLibcallName (RTLIB::FMINIMUM_NUM_F128, " fminimum_numf128" );
321
+ Info.setLibcallName (RTLIB::FMAXIMUM_NUM_F128, " fmaximum_numf128" );
322
+ Info.setLibcallName (RTLIB::LROUND_F128, " lroundf128" );
323
+ Info.setLibcallName (RTLIB::LLROUND_F128, " llroundf128" );
324
+ Info.setLibcallName (RTLIB::LRINT_F128, " lrintf128" );
325
+ Info.setLibcallName (RTLIB::LLRINT_F128, " llrintf128" );
326
+ Info.setLibcallName (RTLIB::LDEXP_F128, " ldexpf128" );
327
+ Info.setLibcallName (RTLIB::FREXP_F128, " frexpf128" );
328
+ Info.setLibcallName (RTLIB::MODF_F128, " modff128" );
329
+
330
+ if (FiniteOnlyFuncs) {
331
+ Info.setLibcallName (RTLIB::LOG_FINITE_F128, " __logf128_finite" );
332
+ Info.setLibcallName (RTLIB::LOG2_FINITE_F128, " __log2f128_finite" );
333
+ Info.setLibcallName (RTLIB::LOG10_FINITE_F128, " __log10f128_finite" );
334
+ Info.setLibcallName (RTLIB::EXP_FINITE_F128, " __expf128_finite" );
335
+ Info.setLibcallName (RTLIB::EXP2_FINITE_F128, " __exp2f128_finite" );
336
+ Info.setLibcallName (RTLIB::POW_FINITE_F128, " __powf128_finite" );
337
+ } else {
338
+ Info.setLibcallName (RTLIB::LOG_FINITE_F128, nullptr );
339
+ Info.setLibcallName (RTLIB::LOG2_FINITE_F128, nullptr );
340
+ Info.setLibcallName (RTLIB::LOG10_FINITE_F128, nullptr );
341
+ Info.setLibcallName (RTLIB::EXP_FINITE_F128, nullptr );
342
+ Info.setLibcallName (RTLIB::EXP2_FINITE_F128, nullptr );
343
+ Info.setLibcallName (RTLIB::POW_FINITE_F128, nullptr );
344
+ }
345
+ }
346
+
284
347
// / Set default libcall names. If a target wants to opt-out of a libcall it
285
348
// / should be placed here.
286
349
void RuntimeLibcallsInfo::initLibcalls (const Triple &TT) {
@@ -295,57 +358,8 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
295
358
#undef LIBCALL_NO_NAME
296
359
297
360
// Use the f128 variants of math functions on x86
298
- if (TT.isX86 () && TT.isGNUEnvironment ()) {
299
- setLibcallName (RTLIB::REM_F128, " fmodf128" );
300
- setLibcallName (RTLIB::FMA_F128, " fmaf128" );
301
- setLibcallName (RTLIB::SQRT_F128, " sqrtf128" );
302
- setLibcallName (RTLIB::CBRT_F128, " cbrtf128" );
303
- setLibcallName (RTLIB::LOG_F128, " logf128" );
304
- setLibcallName (RTLIB::LOG_FINITE_F128, " __logf128_finite" );
305
- setLibcallName (RTLIB::LOG2_F128, " log2f128" );
306
- setLibcallName (RTLIB::LOG2_FINITE_F128, " __log2f128_finite" );
307
- setLibcallName (RTLIB::LOG10_F128, " log10f128" );
308
- setLibcallName (RTLIB::LOG10_FINITE_F128, " __log10f128_finite" );
309
- setLibcallName (RTLIB::EXP_F128, " expf128" );
310
- setLibcallName (RTLIB::EXP_FINITE_F128, " __expf128_finite" );
311
- setLibcallName (RTLIB::EXP2_F128, " exp2f128" );
312
- setLibcallName (RTLIB::EXP2_FINITE_F128, " __exp2f128_finite" );
313
- setLibcallName (RTLIB::EXP10_F128, " exp10f128" );
314
- setLibcallName (RTLIB::SIN_F128, " sinf128" );
315
- setLibcallName (RTLIB::COS_F128, " cosf128" );
316
- setLibcallName (RTLIB::TAN_F128, " tanf128" );
317
- setLibcallName (RTLIB::SINCOS_F128, " sincosf128" );
318
- setLibcallName (RTLIB::ASIN_F128, " asinf128" );
319
- setLibcallName (RTLIB::ACOS_F128, " acosf128" );
320
- setLibcallName (RTLIB::ATAN_F128, " atanf128" );
321
- setLibcallName (RTLIB::ATAN2_F128, " atan2f128" );
322
- setLibcallName (RTLIB::SINH_F128, " sinhf128" );
323
- setLibcallName (RTLIB::COSH_F128, " coshf128" );
324
- setLibcallName (RTLIB::TANH_F128, " tanhf128" );
325
- setLibcallName (RTLIB::POW_F128, " powf128" );
326
- setLibcallName (RTLIB::POW_FINITE_F128, " __powf128_finite" );
327
- setLibcallName (RTLIB::CEIL_F128, " ceilf128" );
328
- setLibcallName (RTLIB::TRUNC_F128, " truncf128" );
329
- setLibcallName (RTLIB::RINT_F128, " rintf128" );
330
- setLibcallName (RTLIB::NEARBYINT_F128, " nearbyintf128" );
331
- setLibcallName (RTLIB::ROUND_F128, " roundf128" );
332
- setLibcallName (RTLIB::ROUNDEVEN_F128, " roundevenf128" );
333
- setLibcallName (RTLIB::FLOOR_F128, " floorf128" );
334
- setLibcallName (RTLIB::COPYSIGN_F128, " copysignf128" );
335
- setLibcallName (RTLIB::FMIN_F128, " fminf128" );
336
- setLibcallName (RTLIB::FMAX_F128, " fmaxf128" );
337
- setLibcallName (RTLIB::FMINIMUM_F128, " fminimumf128" );
338
- setLibcallName (RTLIB::FMAXIMUM_F128, " fmaximumf128" );
339
- setLibcallName (RTLIB::FMINIMUM_NUM_F128, " fminimum_numf128" );
340
- setLibcallName (RTLIB::FMAXIMUM_NUM_F128, " fmaximum_numf128" );
341
- setLibcallName (RTLIB::LROUND_F128, " lroundf128" );
342
- setLibcallName (RTLIB::LLROUND_F128, " llroundf128" );
343
- setLibcallName (RTLIB::LRINT_F128, " lrintf128" );
344
- setLibcallName (RTLIB::LLRINT_F128, " llrintf128" );
345
- setLibcallName (RTLIB::LDEXP_F128, " ldexpf128" );
346
- setLibcallName (RTLIB::FREXP_F128, " frexpf128" );
347
- setLibcallName (RTLIB::MODF_F128, " modff128" );
348
- }
361
+ if (TT.isX86 () && TT.isGNUEnvironment ())
362
+ setLongDoubleIsF128Libm (*this , /* FiniteOnlyFuncs=*/ true );
349
363
350
364
// For IEEE quad-precision libcall names, PPC uses "kf" instead of "tf".
351
365
if (TT.isPPC ()) {
@@ -379,56 +393,10 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
379
393
setLibcallName (RTLIB::OGT_F128, " __gtkf2" );
380
394
setLibcallName (RTLIB::UO_F128, " __unordkf2" );
381
395
382
- setLibcallName (RTLIB::ACOS_F128, " acosf128" );
383
- setLibcallName (RTLIB::ASIN_F128, " asinf128" );
384
- setLibcallName (RTLIB::ATAN2_F128, " atan2f128" );
385
- setLibcallName (RTLIB::ATAN_F128, " atanf128" );
386
- setLibcallName (RTLIB::CBRT_F128, " cbrtf128" );
387
- setLibcallName (RTLIB::COPYSIGN_F128, " copysignf128" );
388
- setLibcallName (RTLIB::COSH_F128, " coshf128" );
389
- setLibcallName (RTLIB::EXP10_F128, " exp10f128" );
390
- setLibcallName (RTLIB::FMAXIMUM_F128, " fmaximumf128" );
391
- setLibcallName (RTLIB::FMAXIMUM_NUM_F128, " fmaximum_numf128" );
392
- setLibcallName (RTLIB::FMINIMUM_F128, " fminimumf128" );
393
- setLibcallName (RTLIB::FMINIMUM_NUM_F128, " fminimum_numf128" );
394
- setLibcallName (RTLIB::LDEXP_F128, " ldexpf128" );
395
- setLibcallName (RTLIB::MODF_F128, " modff128" );
396
- setLibcallName (RTLIB::ROUNDEVEN_F128, " roundevenf128" );
397
- setLibcallName (RTLIB::SINH_F128, " sinhf128" );
398
- setLibcallName (RTLIB::TANH_F128, " tanhf128" );
399
- setLibcallName (RTLIB::TAN_F128, " tanf128" );
400
- setLibcallName (RTLIB::LOG_F128, " logf128" );
401
- setLibcallName (RTLIB::LOG2_F128, " log2f128" );
402
- setLibcallName (RTLIB::LOG10_F128, " log10f128" );
403
- setLibcallName (RTLIB::EXP_F128, " expf128" );
404
- setLibcallName (RTLIB::EXP2_F128, " exp2f128" );
405
- setLibcallName (RTLIB::SIN_F128, " sinf128" );
406
- setLibcallName (RTLIB::COS_F128, " cosf128" );
407
- setLibcallName (RTLIB::SINCOS_F128, " sincosf128" );
408
- setLibcallName (RTLIB::POW_F128, " powf128" );
409
- setLibcallName (RTLIB::FMIN_F128, " fminf128" );
410
- setLibcallName (RTLIB::FMAX_F128, " fmaxf128" );
411
- setLibcallName (RTLIB::REM_F128, " fmodf128" );
412
- setLibcallName (RTLIB::SQRT_F128, " sqrtf128" );
413
- setLibcallName (RTLIB::CEIL_F128, " ceilf128" );
414
- setLibcallName (RTLIB::FLOOR_F128, " floorf128" );
415
- setLibcallName (RTLIB::TRUNC_F128, " truncf128" );
416
- setLibcallName (RTLIB::ROUND_F128, " roundf128" );
417
- setLibcallName (RTLIB::LROUND_F128, " lroundf128" );
418
- setLibcallName (RTLIB::LLROUND_F128, " llroundf128" );
419
- setLibcallName (RTLIB::RINT_F128, " rintf128" );
420
- setLibcallName (RTLIB::LRINT_F128, " lrintf128" );
421
- setLibcallName (RTLIB::LLRINT_F128, " llrintf128" );
422
- setLibcallName (RTLIB::NEARBYINT_F128, " nearbyintf128" );
423
- setLibcallName (RTLIB::FMA_F128, " fmaf128" );
424
- setLibcallName (RTLIB::FREXP_F128, " frexpf128" );
425
-
426
- // TODO: Do these exist?
427
- setLibcallName (RTLIB::EXP_FINITE_F128, nullptr );
428
- setLibcallName (RTLIB::EXP2_FINITE_F128, nullptr );
429
- setLibcallName (RTLIB::LOG_FINITE_F128, nullptr );
430
- setLibcallName (RTLIB::LOG2_FINITE_F128, nullptr );
431
- setLibcallName (RTLIB::LOG10_FINITE_F128, nullptr );
396
+ setLongDoubleIsF128Libm (*this );
397
+
398
+ // TODO: Do the finite only functions exist?
399
+ setLongDoubleIsF128Libm (*this , /* FiniteOnlyFuncs=*/ false );
432
400
433
401
if (TT.isOSAIX ()) {
434
402
bool isPPC64 = TT.isPPC64 ();
0 commit comments