[libc][bazel] Add BUILD rules for float16 math functions. (#114187)

Adds libc_math_function rules for various f16* and *f16 functions.
Closes #114140
This commit is contained in:
Alexey Samsonov 2024-10-30 19:05:24 -07:00 committed by GitHub
parent de7ad6b682
commit 14f3cdc8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1702,6 +1702,17 @@ libc_support_library(
],
)
libc_support_library(
name = "sincosf16_utils",
hdrs = ["src/math/generic/sincosf16_utils.h"],
deps = [
":__support_common",
":__support_fputil_fp_bits",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
],
)
libc_support_library(
name = "explogxf",
srcs = ["src/math/generic/explogxf.cpp"],
@ -1773,6 +1784,18 @@ libc_support_library(
],
)
libc_support_library(
name = "expxf16",
hdrs = ["src/math/generic/expxf16.h"],
deps = [
":__support_cpp_array",
":__support_fputil_cast",
":__support_fputil_fp_bits",
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
],
)
################################ math targets ##################################
libc_math_function(
@ -1882,6 +1905,8 @@ libc_math_function(name = "canonicalizel")
libc_math_function(name = "canonicalizef128")
libc_math_function(name = "canonicalizef16")
libc_math_function(
name = "cbrt",
additional_deps = [
@ -1906,6 +1931,8 @@ libc_math_function(name = "ceill")
libc_math_function(name = "ceilf128")
libc_math_function(name = "ceilf16")
libc_math_function(name = "copysign")
libc_math_function(name = "copysignf")
@ -1914,6 +1941,8 @@ libc_math_function(name = "copysignl")
libc_math_function(name = "copysignf128")
libc_math_function(name = "copysignf16")
libc_math_function(
name = "cos",
additional_deps = [
@ -1950,6 +1979,13 @@ libc_math_function(
],
)
libc_math_function(
name = "coshf16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "cospif",
additional_deps = [
@ -1965,6 +2001,15 @@ libc_math_function(
],
)
libc_math_function(
name = "cospif16",
additional_deps = [
":__support_fputil_multiply_add",
":__support_macros_optimization",
":sincosf16_utils",
],
)
libc_math_function(name = "daddl")
libc_math_function(name = "daddf128")
@ -2048,6 +2093,13 @@ libc_math_function(
],
)
libc_math_function(
name = "expf16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "exp10",
additional_deps = [
@ -2072,6 +2124,20 @@ libc_math_function(
],
)
libc_math_function(
name = "exp10f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "exp10m1f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "exp2",
additional_deps = [
@ -2096,6 +2162,13 @@ libc_math_function(
],
)
libc_math_function(
name = "exp2f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "exp2m1f",
additional_deps = [
@ -2104,6 +2177,13 @@ libc_math_function(
],
)
libc_math_function(
name = "exp2m1f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "expm1",
additional_deps = [
@ -2135,6 +2215,101 @@ libc_math_function(
],
)
libc_math_function(
name = "expm1f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(name = "f16add")
libc_math_function(name = "f16addf")
libc_math_function(name = "f16addf128")
libc_math_function(name = "f16addl")
libc_math_function(name = "f16div")
libc_math_function(name = "f16divf")
libc_math_function(name = "f16divf128")
libc_math_function(name = "f16divl")
libc_math_function(
name = "f16fma",
additional_deps = [
":__support_fputil_fma",
],
)
libc_math_function(
name = "f16fmaf",
additional_deps = [
":__support_fputil_fma",
],
)
libc_math_function(
name = "f16fmaf128",
additional_deps = [
":__support_fputil_fma",
],
)
libc_math_function(
name = "f16fmal",
additional_deps = [
":__support_fputil_fma",
],
)
libc_math_function(name = "f16mul")
libc_math_function(name = "f16mulf")
libc_math_function(name = "f16mulf128")
libc_math_function(name = "f16mull")
libc_math_function(
name = "f16sqrt",
additional_deps = [
":__support_fputil_sqrt",
],
)
libc_math_function(
name = "f16sqrtf",
additional_deps = [
":__support_fputil_sqrt",
],
)
libc_math_function(
name = "f16sqrtf128",
additional_deps = [
":__support_fputil_sqrt",
],
)
libc_math_function(
name = "f16sqrtl",
additional_deps = [
":__support_fputil_sqrt",
],
)
libc_math_function(name = "f16sub")
libc_math_function(name = "f16subf")
libc_math_function(name = "f16subf128")
libc_math_function(name = "f16subl")
libc_math_function(name = "fabs")
libc_math_function(name = "fabsf")
@ -2143,6 +2318,8 @@ libc_math_function(name = "fabsl")
libc_math_function(name = "fabsf128")
libc_math_function(name = "fabsf16")
libc_math_function(name = "fadd")
libc_math_function(name = "faddl")
@ -2157,6 +2334,8 @@ libc_math_function(name = "fdiml")
libc_math_function(name = "fdimf128")
libc_math_function(name = "fdimf16")
libc_math_function(name = "fdiv")
libc_math_function(name = "fdivl")
@ -2192,6 +2371,8 @@ libc_math_function(name = "floorl")
libc_math_function(name = "floorf128")
libc_math_function(name = "floorf16")
# TODO: Add fma, fmaf, fmal, fmaf128 functions.
libc_math_function(name = "fmax")
@ -2202,6 +2383,8 @@ libc_math_function(name = "fmaxl")
libc_math_function(name = "fmaxf128")
libc_math_function(name = "fmaxf16")
libc_math_function(name = "fmaximum")
libc_math_function(name = "fmaximumf")
@ -2210,6 +2393,8 @@ libc_math_function(name = "fmaximuml")
libc_math_function(name = "fmaximumf128")
libc_math_function(name = "fmaximumf16")
libc_math_function(name = "fmaximum_mag")
libc_math_function(name = "fmaximum_magf")
@ -2218,6 +2403,8 @@ libc_math_function(name = "fmaximum_magl")
libc_math_function(name = "fmaximum_magf128")
libc_math_function(name = "fmaximum_magf16")
libc_math_function(name = "fmaximum_mag_num")
libc_math_function(name = "fmaximum_mag_numf")
@ -2226,6 +2413,8 @@ libc_math_function(name = "fmaximum_mag_numl")
libc_math_function(name = "fmaximum_mag_numf128")
libc_math_function(name = "fmaximum_mag_numf16")
libc_math_function(name = "fmaximum_num")
libc_math_function(name = "fmaximum_numf")
@ -2234,6 +2423,8 @@ libc_math_function(name = "fmaximum_numl")
libc_math_function(name = "fmaximum_numf128")
libc_math_function(name = "fmaximum_numf16")
libc_math_function(name = "fmin")
libc_math_function(name = "fminf")
@ -2242,6 +2433,8 @@ libc_math_function(name = "fminl")
libc_math_function(name = "fminf128")
libc_math_function(name = "fminf16")
libc_math_function(name = "fminimum")
libc_math_function(name = "fminimumf")
@ -2250,6 +2443,8 @@ libc_math_function(name = "fminimuml")
libc_math_function(name = "fminimumf128")
libc_math_function(name = "fminimumf16")
libc_math_function(name = "fminimum_mag")
libc_math_function(name = "fminimum_magf")
@ -2258,6 +2453,8 @@ libc_math_function(name = "fminimum_magl")
libc_math_function(name = "fminimum_magf128")
libc_math_function(name = "fminimum_magf16")
libc_math_function(name = "fminimum_mag_num")
libc_math_function(name = "fminimum_mag_numf")
@ -2266,6 +2463,8 @@ libc_math_function(name = "fminimum_mag_numl")
libc_math_function(name = "fminimum_mag_numf128")
libc_math_function(name = "fminimum_mag_numf16")
libc_math_function(name = "fminimum_num")
libc_math_function(name = "fminimum_numf")
@ -2274,6 +2473,8 @@ libc_math_function(name = "fminimum_numl")
libc_math_function(name = "fminimum_numf128")
libc_math_function(name = "fminimum_numf16")
libc_math_function(
name = "fmod",
additional_deps = [
@ -2302,6 +2503,13 @@ libc_math_function(
],
)
libc_math_function(
name = "fmodf16",
additional_deps = [
":__support_fputil_generic_fmod",
],
)
libc_math_function(
name = "fmul",
additional_deps = [
@ -2321,6 +2529,8 @@ libc_math_function(name = "frexpl")
libc_math_function(name = "frexpf128")
libc_math_function(name = "frexpf16")
libc_math_function(name = "fromfp")
libc_math_function(name = "fromfpf")
@ -2329,6 +2539,8 @@ libc_math_function(name = "fromfpl")
libc_math_function(name = "fromfpf128")
libc_math_function(name = "fromfpf16")
libc_math_function(name = "fromfpx")
libc_math_function(name = "fromfpxf")
@ -2337,6 +2549,8 @@ libc_math_function(name = "fromfpxl")
libc_math_function(name = "fromfpxf128")
libc_math_function(name = "fromfpxf16")
libc_math_function(
name = "fsqrt",
additional_deps = [
@ -2372,6 +2586,8 @@ libc_math_function(name = "getpayloadl")
libc_math_function(name = "getpayloadf128")
libc_math_function(name = "getpayloadf16")
libc_math_function(name = "hypot")
libc_math_function(
@ -2390,6 +2606,8 @@ libc_math_function(name = "ilogbl")
libc_math_function(name = "ilogbf128")
libc_math_function(name = "ilogbf16")
libc_math_function(name = "ldexp")
libc_math_function(name = "ldexpf")
@ -2398,6 +2616,8 @@ libc_math_function(name = "ldexpl")
libc_math_function(name = "ldexpf128")
libc_math_function(name = "ldexpf16")
libc_math_function(name = "llogb")
libc_math_function(name = "llogbf")
@ -2406,6 +2626,8 @@ libc_math_function(name = "llogbl")
libc_math_function(name = "llogbf128")
libc_math_function(name = "llogbf16")
libc_math_function(name = "llrint")
libc_math_function(name = "llrintf")
@ -2414,6 +2636,8 @@ libc_math_function(name = "llrintl")
libc_math_function(name = "llrintf128")
libc_math_function(name = "llrintf16")
libc_math_function(name = "llround")
libc_math_function(name = "llroundf")
@ -2422,6 +2646,8 @@ libc_math_function(name = "llroundl")
libc_math_function(name = "llroundf128")
libc_math_function(name = "llroundf16")
libc_math_function(
name = "log",
additional_deps = [
@ -2450,6 +2676,13 @@ libc_math_function(
],
)
libc_math_function(
name = "logf16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "log10",
additional_deps = [
@ -2478,6 +2711,13 @@ libc_math_function(
],
)
libc_math_function(
name = "log10f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "log1p",
additional_deps = [
@ -2532,6 +2772,13 @@ libc_math_function(
],
)
libc_math_function(
name = "log2f16",
additional_deps = [
":expxf16",
],
)
libc_math_function(name = "logb")
libc_math_function(name = "logbf")
@ -2540,6 +2787,8 @@ libc_math_function(name = "logbl")
libc_math_function(name = "logbf128")
libc_math_function(name = "logbf16")
libc_math_function(name = "lrint")
libc_math_function(name = "lrintf")
@ -2548,6 +2797,8 @@ libc_math_function(name = "lrintl")
libc_math_function(name = "lrintf128")
libc_math_function(name = "lrintf16")
libc_math_function(name = "lround")
libc_math_function(name = "lroundf")
@ -2556,6 +2807,8 @@ libc_math_function(name = "lroundl")
libc_math_function(name = "lroundf128")
libc_math_function(name = "lroundf16")
libc_math_function(name = "modf")
libc_math_function(name = "modff")
@ -2564,6 +2817,8 @@ libc_math_function(name = "modfl")
libc_math_function(name = "modff128")
libc_math_function(name = "modff16")
libc_math_function(
name = "nan",
additional_deps = [
@ -2596,6 +2851,14 @@ libc_math_function(
],
)
libc_math_function(
name = "nanf16",
additional_deps = [
":__support_str_to_float",
":errno",
],
)
libc_math_function(name = "nearbyint")
libc_math_function(name = "nearbyintf")
@ -2604,6 +2867,8 @@ libc_math_function(name = "nearbyintl")
libc_math_function(name = "nearbyintf128")
libc_math_function(name = "nearbyintf16")
libc_math_function(name = "nextafter")
libc_math_function(name = "nextafterf")
@ -2612,6 +2877,8 @@ libc_math_function(name = "nextafterl")
libc_math_function(name = "nextafterf128")
libc_math_function(name = "nextafterf16")
libc_math_function(name = "nextdown")
libc_math_function(name = "nextdownf")
@ -2620,10 +2887,14 @@ libc_math_function(name = "nextdownl")
libc_math_function(name = "nextdownf128")
libc_math_function(name = "nextdownf16")
libc_math_function(name = "nexttoward")
libc_math_function(name = "nexttowardf")
libc_math_function(name = "nexttowardf16")
libc_math_function(name = "nexttowardl")
libc_math_function(name = "nextup")
@ -2634,6 +2905,8 @@ libc_math_function(name = "nextupl")
libc_math_function(name = "nextupf128")
libc_math_function(name = "nextupf16")
libc_math_function(
name = "pow",
additional_deps = [
@ -2671,6 +2944,8 @@ libc_math_function(name = "remainderl")
libc_math_function(name = "remainderf128")
libc_math_function(name = "remainderf16")
libc_math_function(name = "remquo")
libc_math_function(name = "remquof")
@ -2679,6 +2954,8 @@ libc_math_function(name = "remquol")
libc_math_function(name = "remquof128")
libc_math_function(name = "remquof16")
libc_math_function(name = "rint")
libc_math_function(name = "rintf")
@ -2687,6 +2964,8 @@ libc_math_function(name = "rintl")
libc_math_function(name = "rintf128")
libc_math_function(name = "rintf16")
libc_math_function(name = "round")
libc_math_function(name = "roundf")
@ -2695,6 +2974,8 @@ libc_math_function(name = "roundl")
libc_math_function(name = "roundf128")
libc_math_function(name = "roundf16")
libc_math_function(name = "roundeven")
libc_math_function(name = "roundevenf")
@ -2703,6 +2984,8 @@ libc_math_function(name = "roundevenl")
libc_math_function(name = "roundevenf128")
libc_math_function(name = "roundevenf16")
libc_math_function(name = "scalbln")
libc_math_function(name = "scalblnf")
@ -2711,6 +2994,8 @@ libc_math_function(name = "scalblnl")
libc_math_function(name = "scalblnf128")
libc_math_function(name = "scalblnf16")
libc_math_function(name = "scalbn")
libc_math_function(name = "scalbnf")
@ -2719,6 +3004,8 @@ libc_math_function(name = "scalbnl")
libc_math_function(name = "scalbnf128")
libc_math_function(name = "scalbnf16")
libc_math_function(name = "setpayload")
libc_math_function(name = "setpayloadf")
@ -2727,6 +3014,8 @@ libc_math_function(name = "setpayloadl")
libc_math_function(name = "setpayloadf128")
libc_math_function(name = "setpayloadf16")
libc_math_function(name = "setpayloadsig")
libc_math_function(name = "setpayloadsigf")
@ -2735,6 +3024,8 @@ libc_math_function(name = "setpayloadsigl")
libc_math_function(name = "setpayloadsigf128")
libc_math_function(name = "setpayloadsigf16")
libc_math_function(
name = "sin",
additional_deps = [
@ -2797,6 +3088,13 @@ libc_math_function(
],
)
libc_math_function(
name = "sinhf16",
additional_deps = [
":expxf16",
],
)
libc_math_function(
name = "sinpif",
additional_deps = [
@ -2804,6 +3102,15 @@ libc_math_function(
],
)
libc_math_function(
name = "sinpif16",
additional_deps = [
":__support_fputil_nearest_integer",
":__support_fputil_polyeval",
":sincosf16_utils",
],
)
libc_math_function(
name = "sqrt",
additional_deps = [
@ -2832,6 +3139,13 @@ libc_math_function(
],
)
libc_math_function(
name = "sqrtf16",
additional_deps = [
":__support_fputil_sqrt",
],
)
libc_math_function(
name = "tan",
additional_deps = [
@ -2872,6 +3186,13 @@ libc_math_function(
],
)
libc_math_function(
name = "tanhf16",
additional_deps = [
":expxf16",
],
)
libc_math_function(name = "totalorder")
libc_math_function(name = "totalorderf")
@ -2880,6 +3201,8 @@ libc_math_function(name = "totalorderl")
libc_math_function(name = "totalorderf128")
libc_math_function(name = "totalorderf16")
libc_math_function(name = "totalordermag")
libc_math_function(name = "totalordermagf")
@ -2888,6 +3211,8 @@ libc_math_function(name = "totalordermagl")
libc_math_function(name = "totalordermagf128")
libc_math_function(name = "totalordermagf16")
libc_math_function(name = "trunc")
libc_math_function(name = "truncf")
@ -2896,6 +3221,8 @@ libc_math_function(name = "truncl")
libc_math_function(name = "truncf128")
libc_math_function(name = "truncf16")
libc_math_function(name = "ufromfp")
libc_math_function(name = "ufromfpf")
@ -2904,6 +3231,8 @@ libc_math_function(name = "ufromfpl")
libc_math_function(name = "ufromfpf128")
libc_math_function(name = "ufromfpf16")
libc_math_function(name = "ufromfpx")
libc_math_function(name = "ufromfpxf")
@ -2912,6 +3241,8 @@ libc_math_function(name = "ufromfpxl")
libc_math_function(name = "ufromfpxf128")
libc_math_function(name = "ufromfpxf16")
############################## inttypes targets ##############################
libc_function(