diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td index c236e698759cc..a881b5cbc5d82 100644 --- a/llvm/include/llvm/IR/RuntimeLibcalls.td +++ b/llvm/include/llvm/IR/RuntimeLibcalls.td @@ -352,17 +352,26 @@ def MIPS16_RET_DF : RuntimeLibcall; def MIPS16_RET_SC : RuntimeLibcall; def MIPS16_RET_SF : RuntimeLibcall; -multiclass LibmLongDoubleLibCall { +// Produce libcall impls for all float types. If provided, `rtbasename` should +// contain an `X` that will be replaced with the `f`/`l`/`fX` suffix (if not +// provided, it is appended to the def name). +multiclass LibmLibcallImpls { + def NAME#"f" + : RuntimeLibcallImpl(libcall_basename#"_F32"), + !subst("X", "f", rtbasename)>; + def NAME#"" + : RuntimeLibcallImpl(libcall_basename#"_F64"), + !subst("X", "", rtbasename)>; def NAME#"_f128" : RuntimeLibcallImpl(libcall_basename#"_F128"), - !strconcat(rtbasename, "l")>; + !subst("X", "l", rtbasename)>; def NAME#"_ppcf128" : RuntimeLibcallImpl(libcall_basename#"_PPCF128"), - !strconcat(rtbasename, "l")>; + !subst("X", "l", rtbasename)>; def NAME#"_f80" : RuntimeLibcallImpl(libcall_basename#"_F80"), - !strconcat(rtbasename, "l")>; + !subst("X", "l", rtbasename)>; } // AArch64 calls @@ -692,217 +701,55 @@ def __riscv_flush_icache : RuntimeLibcallImpl; // libm //-------------------------------------------------------------------- -def fmodf : RuntimeLibcallImpl; -def fmod : RuntimeLibcallImpl; -def fmodl_f128 : RuntimeLibcallImpl; -def fmodl_f80 : RuntimeLibcallImpl; -def fmodl_ppc128 : RuntimeLibcallImpl; - -def fmaf : RuntimeLibcallImpl; -def fma : RuntimeLibcallImpl; -defm fma : LibmLongDoubleLibCall; - -def sqrtf : RuntimeLibcallImpl; -def sqrt : RuntimeLibcallImpl; -defm sqrt : LibmLongDoubleLibCall; - -def cbrtf : RuntimeLibcallImpl; -def cbrt : RuntimeLibcallImpl; -defm cbrt : LibmLongDoubleLibCall; - -def logf : RuntimeLibcallImpl; -def log : RuntimeLibcallImpl; -defm log : LibmLongDoubleLibCall; - -def __logf_finite : RuntimeLibcallImpl; -def __log_finite : RuntimeLibcallImpl; -def __logl_finite_f80 : RuntimeLibcallImpl; -def __logl_finite_f128 : RuntimeLibcallImpl; -def __logl_finite_ppcf128 : RuntimeLibcallImpl; - -def log2f : RuntimeLibcallImpl; -def log2 : RuntimeLibcallImpl; -defm log2 : LibmLongDoubleLibCall; - -def __log2f_finite : RuntimeLibcallImpl; -def __log2_finite : RuntimeLibcallImpl; -def __log2l_finite_f80 : RuntimeLibcallImpl; -def __log2l_finite_f128 : RuntimeLibcallImpl; -def __log2l_finite_ppcf128 : RuntimeLibcallImpl; - -def log10f : RuntimeLibcallImpl; -def log10 : RuntimeLibcallImpl; -defm log10 : LibmLongDoubleLibCall; - -def __log10f_finite : RuntimeLibcallImpl; -def __log10_finite : RuntimeLibcallImpl; -def __log10l_finite_f80 : RuntimeLibcallImpl; -def __log10l_finite_f128 : RuntimeLibcallImpl; -def __log10l_finite_ppcf128 : RuntimeLibcallImpl; - -def expf : RuntimeLibcallImpl; -def exp : RuntimeLibcallImpl; -defm exp : LibmLongDoubleLibCall<"EXP", "exp">; - -def __expf_finite : RuntimeLibcallImpl; -def __exp_finite : RuntimeLibcallImpl; -def __expl_finite_f80 : RuntimeLibcallImpl; -def __expl_finite_f128 : RuntimeLibcallImpl; -def __expl_finite_ppcf128 : RuntimeLibcallImpl; - -def exp2f : RuntimeLibcallImpl; -def exp2 : RuntimeLibcallImpl; -defm exp2 : LibmLongDoubleLibCall<"EXP2", "exp2">; - -def __exp2f_finite : RuntimeLibcallImpl; -def __exp2_finite : RuntimeLibcallImpl; -def __exp2l_finite_f80 : RuntimeLibcallImpl; -def __exp2l_finite_f128 : RuntimeLibcallImpl; -def __exp2l_finite_ppcf128 : RuntimeLibcallImpl; - -def exp10f : RuntimeLibcallImpl; -def exp10 : RuntimeLibcallImpl; -def exp10l_f80 : RuntimeLibcallImpl; -def exp10l_f128 : RuntimeLibcallImpl; -def exp10l_ppcf128 : RuntimeLibcallImpl; - -def sinf : RuntimeLibcallImpl; -def sin : RuntimeLibcallImpl; -defm sin : LibmLongDoubleLibCall; - -def cosf : RuntimeLibcallImpl; -def cos : RuntimeLibcallImpl; -defm cos : LibmLongDoubleLibCall; - -def tanf : RuntimeLibcallImpl; -def tan : RuntimeLibcallImpl; -defm tan : LibmLongDoubleLibCall; - -def sinhf : RuntimeLibcallImpl; -def sinh : RuntimeLibcallImpl; -defm sinh : LibmLongDoubleLibCall; - -def coshf : RuntimeLibcallImpl; -def cosh : RuntimeLibcallImpl; -defm cosh : LibmLongDoubleLibCall; - -def tanhf : RuntimeLibcallImpl; -def tanh : RuntimeLibcallImpl; -defm tanh : LibmLongDoubleLibCall; - -def asinf : RuntimeLibcallImpl; -def asin : RuntimeLibcallImpl; -defm asin : LibmLongDoubleLibCall; - -def acosf : RuntimeLibcallImpl; -def acos : RuntimeLibcallImpl; -defm acos : LibmLongDoubleLibCall; - -def atanf : RuntimeLibcallImpl; -def atan : RuntimeLibcallImpl; -defm atan : LibmLongDoubleLibCall; - -def atan2f : RuntimeLibcallImpl; -def atan2 : RuntimeLibcallImpl; -defm atan2 : LibmLongDoubleLibCall; - -def powf : RuntimeLibcallImpl; -def pow : RuntimeLibcallImpl; -defm pow : LibmLongDoubleLibCall; - -def __powf_finite : RuntimeLibcallImpl; -def __pow_finite : RuntimeLibcallImpl; -def __powl_finite_f80 : RuntimeLibcallImpl; -def __powl_finite_f128 : RuntimeLibcallImpl; -def __powl_finite_ppcf128 : RuntimeLibcallImpl; - -def ceilf : RuntimeLibcallImpl; -def ceil : RuntimeLibcallImpl; -defm ceil : LibmLongDoubleLibCall; - -def truncf : RuntimeLibcallImpl; -def trunc : RuntimeLibcallImpl; -defm trunc : LibmLongDoubleLibCall; - -def rintf : RuntimeLibcallImpl; -def rint : RuntimeLibcallImpl; -defm rint : LibmLongDoubleLibCall; - -def nearbyintf : RuntimeLibcallImpl; -def nearbyint : RuntimeLibcallImpl; -defm nearbyint : LibmLongDoubleLibCall; - -def roundf : RuntimeLibcallImpl; -def round : RuntimeLibcallImpl; -defm round : LibmLongDoubleLibCall; - -def roundevenf : RuntimeLibcallImpl; -def roundeven : RuntimeLibcallImpl; -defm roundeven : LibmLongDoubleLibCall; - -def floorf : RuntimeLibcallImpl; -def floor : RuntimeLibcallImpl; -defm floor : LibmLongDoubleLibCall; - -def copysignf : RuntimeLibcallImpl; -def copysign : RuntimeLibcallImpl; -defm copysign : LibmLongDoubleLibCall; - -def fminf : RuntimeLibcallImpl; -def fmin : RuntimeLibcallImpl; -defm fmin : LibmLongDoubleLibCall; - -def fmaxf : RuntimeLibcallImpl; -def fmax : RuntimeLibcallImpl; -defm fmax : LibmLongDoubleLibCall; - -def fminimumf : RuntimeLibcallImpl; -def fminimum : RuntimeLibcallImpl; -defm fminimum : LibmLongDoubleLibCall; - -def fmaximumf : RuntimeLibcallImpl; -def fmaximum : RuntimeLibcallImpl; -defm fmaximum : LibmLongDoubleLibCall; - -def fminimum_numf : RuntimeLibcallImpl; -def fminimum_num : RuntimeLibcallImpl; -defm fminimum_num : LibmLongDoubleLibCall; - -def fmaximum_numf : RuntimeLibcallImpl; -def fmaximum_num : RuntimeLibcallImpl; -defm fmaximum_num : LibmLongDoubleLibCall; - -def lroundf : RuntimeLibcallImpl; -def lround : RuntimeLibcallImpl; -defm lround : LibmLongDoubleLibCall; - -def llroundf : RuntimeLibcallImpl; -def llround : RuntimeLibcallImpl; -defm llround : LibmLongDoubleLibCall; - -def lrintf : RuntimeLibcallImpl; -def lrint : RuntimeLibcallImpl; -defm lrint : LibmLongDoubleLibCall; - -def llrintf : RuntimeLibcallImpl; -def llrint : RuntimeLibcallImpl; -defm llrint : LibmLongDoubleLibCall; - -def ldexpf : RuntimeLibcallImpl; -def ldexp : RuntimeLibcallImpl; -defm ldexp : LibmLongDoubleLibCall; - -def frexpf : RuntimeLibcallImpl; -def frexp : RuntimeLibcallImpl; -defm frexp : LibmLongDoubleLibCall; - -def sincospif : RuntimeLibcallImpl; -def sincospi : RuntimeLibcallImpl; -defm sincospi : LibmLongDoubleLibCall; - -def modff : RuntimeLibcallImpl; -def modf : RuntimeLibcallImpl; -defm modf : LibmLongDoubleLibCall; +defm fmod : LibmLibcallImpls<"REM">; +defm fma : LibmLibcallImpls; +defm sqrt : LibmLibcallImpls; +defm cbrt : LibmLibcallImpls; +defm log : LibmLibcallImpls; +defm __log_finite : LibmLibcallImpls<"LOG_FINITE", "__logX_finite">; +defm log2 : LibmLibcallImpls; +defm __log2_finite : LibmLibcallImpls<"LOG2_FINITE", "__log2X_finite">; +defm log10 : LibmLibcallImpls; +defm __log10_finite : LibmLibcallImpls<"LOG10_FINITE", "__log10X_finite">; +defm exp : LibmLibcallImpls; +defm __exp_finite : LibmLibcallImpls<"EXP_FINITE", "__expX_finite">; +defm exp2 : LibmLibcallImpls; +defm __exp2_finite : LibmLibcallImpls<"EXP2_FINITE", "__exp2X_finite">; +defm exp10 : LibmLibcallImpls; +defm sin : LibmLibcallImpls; +defm cos : LibmLibcallImpls; +defm tan : LibmLibcallImpls; +defm sinh : LibmLibcallImpls; +defm cosh : LibmLibcallImpls; +defm tanh : LibmLibcallImpls; +defm asin : LibmLibcallImpls; +defm acos : LibmLibcallImpls; +defm atan : LibmLibcallImpls; +defm atan2 : LibmLibcallImpls; +defm pow : LibmLibcallImpls; +defm __pow_finite : LibmLibcallImpls<"POW_FINITE", "__powX_finite">; +defm ceil : LibmLibcallImpls; +defm trunc : LibmLibcallImpls; +defm rint : LibmLibcallImpls; +defm nearbyint : LibmLibcallImpls; +defm round : LibmLibcallImpls; +defm roundeven : LibmLibcallImpls; +defm floor : LibmLibcallImpls; +defm copysign : LibmLibcallImpls; +defm fmin : LibmLibcallImpls; +defm fmax : LibmLibcallImpls; +defm fminimum : LibmLibcallImpls; +defm fmaximum : LibmLibcallImpls; +defm fminimum_num : LibmLibcallImpls; +defm fmaximum_num : LibmLibcallImpls; +defm lround : LibmLibcallImpls; +defm llround : LibmLibcallImpls; +defm lrint : LibmLibcallImpls; +defm llrint : LibmLibcallImpls; +defm ldexp : LibmLibcallImpls; +defm frexp : LibmLibcallImpls; +defm sincospi : LibmLibcallImpls; +defm modf : LibmLibcallImpls; // Floating point environment def fegetenv : RuntimeLibcallImpl; @@ -939,9 +786,7 @@ def __exp10 : RuntimeLibcallImpl; def __sincosf_stret : RuntimeLibcallImpl; def __sincos_stret : RuntimeLibcallImpl; -def sincosf : RuntimeLibcallImpl; -def sincos : RuntimeLibcallImpl; -defm sincos : LibmLongDoubleLibCall; +defm sincos : LibmLibcallImpls; def bzero : RuntimeLibcallImpl; def __bzero : RuntimeLibcallImpl;