Skip to content

Commit 405f30f

Browse files
authored
RuntimeLibcalls: Rename long double libcall entries to include suffix (#163675)
1 parent d43581a commit 405f30f

File tree

2 files changed

+65
-63
lines changed

2 files changed

+65
-63
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,19 @@ def MIPS16_RET_DF : RuntimeLibcall;
405405
def MIPS16_RET_SC : RuntimeLibcall;
406406
def MIPS16_RET_SF : RuntimeLibcall;
407407

408-
multiclass LibmLongDoubleLibCall<string libcall_basename = !toupper(NAME),
409-
string rtbasename = NAME> {
408+
multiclass LibmLongDoubleLibCall<string libcall_basename = !toupper(!substr(NAME, 0, !sub(!size(NAME), 1))),
409+
string rtname = NAME> {
410+
411+
410412
def NAME#"_f128"
411413
: RuntimeLibcallImpl<!cast<RuntimeLibcall>(libcall_basename#"_F128"),
412-
!strconcat(rtbasename, "l")>;
414+
rtname>;
413415
def NAME#"_ppcf128"
414416
: RuntimeLibcallImpl<!cast<RuntimeLibcall>(libcall_basename#"_PPCF128"),
415-
!strconcat(rtbasename, "l")>;
417+
rtname>;
416418
def NAME#"_f80"
417419
: RuntimeLibcallImpl<!cast<RuntimeLibcall>(libcall_basename#"_F80"),
418-
!strconcat(rtbasename, "l")>;
420+
rtname>;
419421
}
420422

421423
// AArch64 calls
@@ -765,19 +767,19 @@ def fmodl_ppc128 : RuntimeLibcallImpl<REM_PPCF128, "fmodl">;
765767

766768
def fmaf : RuntimeLibcallImpl<FMA_F32>;
767769
def fma : RuntimeLibcallImpl<FMA_F64>;
768-
defm fma : LibmLongDoubleLibCall;
770+
defm fmal : LibmLongDoubleLibCall;
769771

770772
def sqrtf : RuntimeLibcallImpl<SQRT_F32>;
771773
def sqrt : RuntimeLibcallImpl<SQRT_F64>;
772-
defm sqrt : LibmLongDoubleLibCall;
774+
defm sqrtl : LibmLongDoubleLibCall;
773775

774776
def cbrtf : RuntimeLibcallImpl<CBRT_F32>;
775777
def cbrt : RuntimeLibcallImpl<CBRT_F64>;
776-
defm cbrt : LibmLongDoubleLibCall;
778+
defm cbrtl : LibmLongDoubleLibCall;
777779

778780
def logf : RuntimeLibcallImpl<LOG_F32>;
779781
def log : RuntimeLibcallImpl<LOG_F64>;
780-
defm log : LibmLongDoubleLibCall;
782+
defm logl : LibmLongDoubleLibCall;
781783

782784
def __logf_finite : RuntimeLibcallImpl<LOG_FINITE_F32>;
783785
def __log_finite : RuntimeLibcallImpl<LOG_FINITE_F64>;
@@ -787,7 +789,7 @@ def __logl_finite_ppcf128 : RuntimeLibcallImpl<LOG_FINITE_PPCF128, "__logl_finit
787789

788790
def log2f : RuntimeLibcallImpl<LOG2_F32>;
789791
def log2 : RuntimeLibcallImpl<LOG2_F64>;
790-
defm log2 : LibmLongDoubleLibCall;
792+
defm log2l : LibmLongDoubleLibCall;
791793

792794
def __log2f_finite : RuntimeLibcallImpl<LOG2_FINITE_F32>;
793795
def __log2_finite : RuntimeLibcallImpl<LOG2_FINITE_F64>;
@@ -797,7 +799,7 @@ def __log2l_finite_ppcf128 : RuntimeLibcallImpl<LOG2_FINITE_PPCF128, "__log2l_fi
797799

798800
def log10f : RuntimeLibcallImpl<LOG10_F32>;
799801
def log10 : RuntimeLibcallImpl<LOG10_F64>;
800-
defm log10 : LibmLongDoubleLibCall;
802+
defm log10l : LibmLongDoubleLibCall;
801803

802804
def __log10f_finite : RuntimeLibcallImpl<LOG10_FINITE_F32>;
803805
def __log10_finite : RuntimeLibcallImpl<LOG10_FINITE_F64>;
@@ -807,7 +809,7 @@ def __log10l_finite_ppcf128 : RuntimeLibcallImpl<LOG10_FINITE_PPCF128, "__log10l
807809

808810
def expf : RuntimeLibcallImpl<EXP_F32>;
809811
def exp : RuntimeLibcallImpl<EXP_F64>;
810-
defm exp : LibmLongDoubleLibCall<"EXP", "exp">;
812+
defm expl : LibmLongDoubleLibCall<"EXP">;
811813

812814
def __expf_finite : RuntimeLibcallImpl<EXP_FINITE_F32>;
813815
def __exp_finite : RuntimeLibcallImpl<EXP_FINITE_F64>;
@@ -817,7 +819,7 @@ def __expl_finite_ppcf128 : RuntimeLibcallImpl<EXP_FINITE_PPCF128, "__expl_finit
817819

818820
def exp2f : RuntimeLibcallImpl<EXP2_F32>;
819821
def exp2 : RuntimeLibcallImpl<EXP2_F64>;
820-
defm exp2 : LibmLongDoubleLibCall<"EXP2", "exp2">;
822+
defm exp2l : LibmLongDoubleLibCall<"EXP2">;
821823

822824
def __exp2f_finite : RuntimeLibcallImpl<EXP2_FINITE_F32>;
823825
def __exp2_finite : RuntimeLibcallImpl<EXP2_FINITE_F64>;
@@ -827,47 +829,47 @@ def __exp2l_finite_ppcf128 : RuntimeLibcallImpl<EXP2_FINITE_PPCF128, "__exp2l_fi
827829

828830
def sinf : RuntimeLibcallImpl<SIN_F32>;
829831
def sin : RuntimeLibcallImpl<SIN_F64>;
830-
defm sin : LibmLongDoubleLibCall;
832+
defm sinl : LibmLongDoubleLibCall;
831833

832834
def cosf : RuntimeLibcallImpl<COS_F32>;
833835
def cos : RuntimeLibcallImpl<COS_F64>;
834-
defm cos : LibmLongDoubleLibCall;
836+
defm cosl : LibmLongDoubleLibCall;
835837

836838
def tanf : RuntimeLibcallImpl<TAN_F32>;
837839
def tan : RuntimeLibcallImpl<TAN_F64>;
838-
defm tan : LibmLongDoubleLibCall;
840+
defm tanl : LibmLongDoubleLibCall;
839841

840842
def sinhf : RuntimeLibcallImpl<SINH_F32>;
841843
def sinh : RuntimeLibcallImpl<SINH_F64>;
842-
defm sinh : LibmLongDoubleLibCall;
844+
defm sinhl : LibmLongDoubleLibCall;
843845

844846
def coshf : RuntimeLibcallImpl<COSH_F32>;
845847
def cosh : RuntimeLibcallImpl<COSH_F64>;
846-
defm cosh : LibmLongDoubleLibCall;
848+
defm coshl : LibmLongDoubleLibCall;
847849

848850
def tanhf : RuntimeLibcallImpl<TANH_F32>;
849851
def tanh : RuntimeLibcallImpl<TANH_F64>;
850-
defm tanh : LibmLongDoubleLibCall;
852+
defm tanhl : LibmLongDoubleLibCall;
851853

852854
def asinf : RuntimeLibcallImpl<ASIN_F32>;
853855
def asin : RuntimeLibcallImpl<ASIN_F64>;
854-
defm asin : LibmLongDoubleLibCall;
856+
defm asinl : LibmLongDoubleLibCall;
855857

856858
def acosf : RuntimeLibcallImpl<ACOS_F32>;
857859
def acos : RuntimeLibcallImpl<ACOS_F64>;
858-
defm acos : LibmLongDoubleLibCall;
860+
defm acosl : LibmLongDoubleLibCall;
859861

860862
def atanf : RuntimeLibcallImpl<ATAN_F32>;
861863
def atan : RuntimeLibcallImpl<ATAN_F64>;
862-
defm atan : LibmLongDoubleLibCall;
864+
defm atanl : LibmLongDoubleLibCall;
863865

864866
def atan2f : RuntimeLibcallImpl<ATAN2_F32>;
865867
def atan2 : RuntimeLibcallImpl<ATAN2_F64>;
866-
defm atan2 : LibmLongDoubleLibCall;
868+
defm atan2l : LibmLongDoubleLibCall;
867869

868870
def powf : RuntimeLibcallImpl<POW_F32>;
869871
def pow : RuntimeLibcallImpl<POW_F64>;
870-
defm pow : LibmLongDoubleLibCall;
872+
defm powl : LibmLongDoubleLibCall;
871873

872874
def __powf_finite : RuntimeLibcallImpl<POW_FINITE_F32>;
873875
def __pow_finite : RuntimeLibcallImpl<POW_FINITE_F64>;
@@ -877,91 +879,91 @@ def __powl_finite_ppcf128 : RuntimeLibcallImpl<POW_FINITE_PPCF128, "__powl_finit
877879

878880
def ceilf : RuntimeLibcallImpl<CEIL_F32>;
879881
def ceil : RuntimeLibcallImpl<CEIL_F64>;
880-
defm ceil : LibmLongDoubleLibCall;
882+
defm ceill : LibmLongDoubleLibCall;
881883

882884
def truncf : RuntimeLibcallImpl<TRUNC_F32>;
883885
def trunc : RuntimeLibcallImpl<TRUNC_F64>;
884-
defm trunc : LibmLongDoubleLibCall;
886+
defm truncl : LibmLongDoubleLibCall;
885887

886888
def rintf : RuntimeLibcallImpl<RINT_F32>;
887889
def rint : RuntimeLibcallImpl<RINT_F64>;
888-
defm rint : LibmLongDoubleLibCall;
890+
defm rintl : LibmLongDoubleLibCall;
889891

890892
def nearbyintf : RuntimeLibcallImpl<NEARBYINT_F32>;
891893
def nearbyint : RuntimeLibcallImpl<NEARBYINT_F64>;
892-
defm nearbyint : LibmLongDoubleLibCall;
894+
defm nearbyintl : LibmLongDoubleLibCall;
893895

894896
def roundf : RuntimeLibcallImpl<ROUND_F32>;
895897
def round : RuntimeLibcallImpl<ROUND_F64>;
896-
defm round : LibmLongDoubleLibCall;
898+
defm roundl : LibmLongDoubleLibCall;
897899

898900
def roundevenf : RuntimeLibcallImpl<ROUNDEVEN_F32>;
899901
def roundeven : RuntimeLibcallImpl<ROUNDEVEN_F64>;
900-
defm roundeven : LibmLongDoubleLibCall;
902+
defm roundevenl : LibmLongDoubleLibCall;
901903

902904
def floorf : RuntimeLibcallImpl<FLOOR_F32>;
903905
def floor : RuntimeLibcallImpl<FLOOR_F64>;
904-
defm floor : LibmLongDoubleLibCall;
906+
defm floorl : LibmLongDoubleLibCall;
905907

906908
def copysignf : RuntimeLibcallImpl<COPYSIGN_F32>;
907909
def copysign : RuntimeLibcallImpl<COPYSIGN_F64>;
908-
defm copysign : LibmLongDoubleLibCall;
910+
defm copysignl : LibmLongDoubleLibCall;
909911

910912
def fminf : RuntimeLibcallImpl<FMIN_F32>;
911913
def fmin : RuntimeLibcallImpl<FMIN_F64>;
912-
defm fmin : LibmLongDoubleLibCall;
914+
defm fminl : LibmLongDoubleLibCall;
913915

914916
def fmaxf : RuntimeLibcallImpl<FMAX_F32>;
915917
def fmax : RuntimeLibcallImpl<FMAX_F64>;
916-
defm fmax : LibmLongDoubleLibCall;
918+
defm fmaxl : LibmLongDoubleLibCall;
917919

918920
def fminimumf : RuntimeLibcallImpl<FMINIMUM_F32>;
919921
def fminimum : RuntimeLibcallImpl<FMINIMUM_F64>;
920-
defm fminimum : LibmLongDoubleLibCall;
922+
defm fminimuml : LibmLongDoubleLibCall;
921923

922924
def fmaximumf : RuntimeLibcallImpl<FMAXIMUM_F32>;
923925
def fmaximum : RuntimeLibcallImpl<FMAXIMUM_F64>;
924-
defm fmaximum : LibmLongDoubleLibCall;
926+
defm fmaximuml : LibmLongDoubleLibCall;
925927

926928
def fminimum_numf : RuntimeLibcallImpl<FMINIMUM_NUM_F32>;
927929
def fminimum_num : RuntimeLibcallImpl<FMINIMUM_NUM_F64>;
928-
defm fminimum_num : LibmLongDoubleLibCall;
930+
defm fminimum_numl : LibmLongDoubleLibCall;
929931

930932
def fmaximum_numf : RuntimeLibcallImpl<FMAXIMUM_NUM_F32>;
931933
def fmaximum_num : RuntimeLibcallImpl<FMAXIMUM_NUM_F64>;
932-
defm fmaximum_num : LibmLongDoubleLibCall;
934+
defm fmaximum_numl : LibmLongDoubleLibCall;
933935

934936
def lroundf : RuntimeLibcallImpl<LROUND_F32>;
935937
def lround : RuntimeLibcallImpl<LROUND_F64>;
936-
defm lround : LibmLongDoubleLibCall;
938+
defm lroundl : LibmLongDoubleLibCall;
937939

938940
def llroundf : RuntimeLibcallImpl<LLROUND_F32>;
939941
def llround : RuntimeLibcallImpl<LLROUND_F64>;
940-
defm llround : LibmLongDoubleLibCall;
942+
defm llroundl : LibmLongDoubleLibCall;
941943

942944
def lrintf : RuntimeLibcallImpl<LRINT_F32>;
943945
def lrint : RuntimeLibcallImpl<LRINT_F64>;
944-
defm lrint : LibmLongDoubleLibCall;
946+
defm lrintl : LibmLongDoubleLibCall;
945947

946948
def llrintf : RuntimeLibcallImpl<LLRINT_F32>;
947949
def llrint : RuntimeLibcallImpl<LLRINT_F64>;
948-
defm llrint : LibmLongDoubleLibCall;
950+
defm llrintl : LibmLongDoubleLibCall;
949951

950952
def ldexpf : RuntimeLibcallImpl<LDEXP_F32>;
951953
def ldexp : RuntimeLibcallImpl<LDEXP_F64>;
952-
defm ldexp : LibmLongDoubleLibCall;
954+
defm ldexpl : LibmLongDoubleLibCall;
953955

954956
def frexpf : RuntimeLibcallImpl<FREXP_F32>;
955957
def frexp : RuntimeLibcallImpl<FREXP_F64>;
956-
defm frexp : LibmLongDoubleLibCall;
958+
defm frexpl : LibmLongDoubleLibCall;
957959

958960
def sincospif : RuntimeLibcallImpl<SINCOSPI_F32>;
959961
def sincospi : RuntimeLibcallImpl<SINCOSPI_F64>;
960-
defm sincospi : LibmLongDoubleLibCall;
962+
defm sincospil : LibmLongDoubleLibCall;
961963

962964
def modff : RuntimeLibcallImpl<MODF_F32>;
963965
def modf : RuntimeLibcallImpl<MODF_F64>;
964-
defm modf : LibmLongDoubleLibCall;
966+
defm modfl : LibmLongDoubleLibCall;
965967

966968
// Floating point environment
967969
def fegetenv : RuntimeLibcallImpl<FEGETENV>;
@@ -1033,7 +1035,7 @@ def __sincos_stret : RuntimeLibcallImpl<SINCOS_STRET_F64>;
10331035

10341036
def sincosf : RuntimeLibcallImpl<SINCOS_F32>;
10351037
def sincos : RuntimeLibcallImpl<SINCOS_F64>;
1036-
defm sincos : LibmLongDoubleLibCall;
1038+
defm sincosl : LibmLongDoubleLibCall;
10371039

10381040
def bzero : RuntimeLibcallImpl<BZERO>;
10391041
def __bzero : RuntimeLibcallImpl<BZERO>;
@@ -1198,9 +1200,9 @@ defvar SecurityCheckCookieIfWinMSVC =
11981200

11991201
defvar LibmHasSinCosF32 = LibcallImpls<(add sincosf), hasSinCos>;
12001202
defvar LibmHasSinCosF64 = LibcallImpls<(add sincos), hasSinCos>;
1201-
defvar LibmHasSinCosF80 = LibcallImpls<(add sincos_f80), hasSinCos>;
1202-
defvar LibmHasSinCosF128 = LibcallImpls<(add sincos_f128), hasSinCos>;
1203-
defvar LibmHasSinCosPPCF128 = LibcallImpls<(add sincos_ppcf128), hasSinCos>;
1203+
defvar LibmHasSinCosF80 = LibcallImpls<(add sincosl_f80), hasSinCos>;
1204+
defvar LibmHasSinCosF128 = LibcallImpls<(add sincosl_f128), hasSinCos>;
1205+
defvar LibmHasSinCosPPCF128 = LibcallImpls<(add sincosl_ppcf128), hasSinCos>;
12041206

12051207
defvar LibmHasExp10F32 = LibcallImpls<(add exp10f), hasExp10>;
12061208
defvar LibmHasExp10F64 = LibcallImpls<(add exp10), hasExp10>;
@@ -1214,8 +1216,8 @@ defvar DefaultLibmExp10 = [
12141216

12151217

12161218
defvar WindowsMathRemovals = [
1217-
ldexpf, ldexp_f80, ldexp_f128, ldexp_ppcf128,
1218-
frexpf, frexp_f80, frexp_f128, frexp_ppcf128
1219+
ldexpf, ldexpl_f80, ldexpl_f128, ldexpl_ppcf128,
1220+
frexpf, frexpl_f80, frexpl_f128, frexpl_ppcf128
12191221
];
12201222

12211223
defvar MostPowI = !listremove(PowiLibcallImpls, [__powitf2_f128, __powitf2_ppc128]);
@@ -1233,11 +1235,11 @@ defvar WinDefaultLibcallImpls = (add WinDefaultLibcallImplsBaseList,
12331235
defvar LibmHasFrexpF32 = LibcallImpls<(add frexpf), isNotOSWindowsOrIsCygwinMinGW>;
12341236
defvar LibmHasLdexpF32 = LibcallImpls<(add ldexpf), isNotOSWindowsOrIsCygwinMinGW>;
12351237

1236-
defvar LibmHasFrexpF80 = LibcallImpls<(add frexp_f80), isNotOSWindowsOrIsCygwinMinGW>;
1237-
defvar LibmHasLdexpF80 = LibcallImpls<(add ldexp_f80), isNotOSWindowsOrIsCygwinMinGW>;
1238+
defvar LibmHasFrexpF80 = LibcallImpls<(add frexpl_f80), isNotOSWindowsOrIsCygwinMinGW>;
1239+
defvar LibmHasLdexpF80 = LibcallImpls<(add ldexpl_f80), isNotOSWindowsOrIsCygwinMinGW>;
12381240

1239-
defvar LibmHasFrexpF128 = LibcallImpls<(add frexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
1240-
defvar LibmHasLdexpF128 = LibcallImpls<(add ldexp_f128), isNotOSWindowsOrIsCygwinMinGW>;
1241+
defvar LibmHasFrexpF128 = LibcallImpls<(add frexpl_f128), isNotOSWindowsOrIsCygwinMinGW>;
1242+
defvar LibmHasLdexpF128 = LibcallImpls<(add ldexpl_f128), isNotOSWindowsOrIsCygwinMinGW>;
12411243

12421244
defvar has__stack_chk_fail = LibcallImpls<(add __stack_chk_fail), isNotOSOpenBSD>;
12431245
defvar has__stack_chk_guard =
@@ -2459,7 +2461,7 @@ defvar X86CommonLibcalls =
24592461
LibcallImpls<(add __bzero), darwinHas__bzero>,
24602462
LibmHasFrexpF32, LibmHasLdexpF32,
24612463
LibmHasFrexpF80, LibmHasLdexpF80,
2462-
LibcallImpls<(add frexp_f128, ldexp_f128, exp10l_f128), hasExpFrexplLdexplF128>,
2464+
LibcallImpls<(add frexpl_f128, ldexpl_f128, exp10l_f128), hasExpFrexplLdexplF128>,
24632465
DefaultRuntimeLibcallImpls_f80,
24642466
LibmHasExp10F32, LibmHasExp10F64, LibmHasExp10F80,
24652467
LibcallImpls<(add MostPowI), isNotOSMSVCRT>,

llvm/unittests/IR/RuntimeLibcallsTest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ TEST(RuntimeLibcallsTest, LibcallImplByName) {
4444
RTLIB::RuntimeLibcallsInfo::lookupLibcallImplName("sqrtl");
4545
ASSERT_EQ(size(SquirtleSquad), 3);
4646
auto I = SquirtleSquad.begin();
47-
EXPECT_EQ(*I++, RTLIB::impl_sqrt_f128);
48-
EXPECT_EQ(*I++, RTLIB::impl_sqrt_f80);
49-
EXPECT_EQ(*I++, RTLIB::impl_sqrt_ppcf128);
47+
EXPECT_EQ(*I++, RTLIB::impl_sqrtl_f128);
48+
EXPECT_EQ(*I++, RTLIB::impl_sqrtl_f80);
49+
EXPECT_EQ(*I++, RTLIB::impl_sqrtl_ppcf128);
5050
}
5151

5252
// Last libcall
5353
{
5454
auto Truncs = RTLIB::RuntimeLibcallsInfo::lookupLibcallImplName("truncl");
5555
ASSERT_EQ(size(Truncs), 3);
5656
auto I = Truncs.begin();
57-
EXPECT_EQ(*I++, RTLIB::impl_trunc_f128);
58-
EXPECT_EQ(*I++, RTLIB::impl_trunc_f80);
59-
EXPECT_EQ(*I++, RTLIB::impl_trunc_ppcf128);
57+
EXPECT_EQ(*I++, RTLIB::impl_truncl_f128);
58+
EXPECT_EQ(*I++, RTLIB::impl_truncl_f80);
59+
EXPECT_EQ(*I++, RTLIB::impl_truncl_ppcf128);
6060
}
6161
}
6262

0 commit comments

Comments
 (0)