Skip to content

Commit 62740d8

Browse files
authored
[libc][bazel][math] Add float128 math functions and their smoke tests to bazel layout. (#87645)
1 parent d3fe2b5 commit 62740d8

File tree

2 files changed

+183
-43
lines changed

2 files changed

+183
-43
lines changed

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,16 +1696,14 @@ libc_math_function(
16961696
)
16971697

16981698
libc_math_function(name = "fabs")
1699-
17001699
libc_math_function(name = "fabsf")
1701-
17021700
libc_math_function(name = "fabsl")
1701+
libc_math_function(name = "fabsf128")
17031702

17041703
libc_math_function(name = "fdim")
1705-
17061704
libc_math_function(name = "fdimf")
1707-
17081705
libc_math_function(name = "fdiml")
1706+
libc_math_function(name = "fdimf128")
17091707

17101708
libc_math_function(
17111709
name = "ceil",
@@ -1730,6 +1728,9 @@ libc_math_function(
17301728
],
17311729
)
17321730

1731+
libc_math_function(name = "ceilf128")
1732+
1733+
17331734
libc_math_function(
17341735
name = "floor",
17351736
specializations = [
@@ -1747,12 +1748,12 @@ libc_math_function(
17471748
)
17481749

17491750
libc_math_function(name = "floorl")
1751+
libc_math_function(name = "floorf128")
17501752

17511753
libc_math_function(name = "ldexp")
1752-
17531754
libc_math_function(name = "ldexpf")
1754-
17551755
libc_math_function(name = "ldexpl")
1756+
libc_math_function(name = "ldexpf128")
17561757

17571758
libc_math_function(
17581759
name = "trunc",
@@ -1771,6 +1772,7 @@ libc_math_function(
17711772
)
17721773

17731774
libc_math_function(name = "truncl")
1775+
libc_math_function(name = "truncf128")
17741776

17751777
libc_math_function(
17761778
name = "round",
@@ -1789,6 +1791,7 @@ libc_math_function(
17891791
)
17901792

17911793
libc_math_function(name = "roundl")
1794+
libc_math_function(name = "roundf128")
17921795

17931796
libc_math_function(
17941797
name = "fmod",
@@ -1805,10 +1808,9 @@ libc_math_function(
18051808
)
18061809

18071810
libc_math_function(name = "frexp")
1808-
18091811
libc_math_function(name = "frexpf")
1810-
18111812
libc_math_function(name = "frexpl")
1813+
libc_math_function(name = "frexpf128")
18121814

18131815
libc_math_function(name = "hypot")
18141816

@@ -1820,40 +1822,32 @@ libc_math_function(
18201822
)
18211823

18221824
libc_math_function(name = "logb")
1823-
18241825
libc_math_function(name = "logbf")
1825-
18261826
libc_math_function(name = "logbl")
1827+
libc_math_function(name = "logbf128")
18271828

18281829
libc_math_function(name = "modf")
1829-
18301830
libc_math_function(name = "modff")
1831-
18321831
libc_math_function(name = "modfl")
1832+
libc_math_function(name = "modff128")
18331833

18341834
libc_math_function(name = "remquo")
1835-
18361835
libc_math_function(name = "remquof")
1837-
18381836
libc_math_function(name = "remquol")
18391837

18401838
libc_math_function(name = "remainder")
1841-
18421839
libc_math_function(name = "remainderf")
1843-
18441840
libc_math_function(name = "remainderl")
18451841

18461842
libc_math_function(name = "fmin")
1847-
18481843
libc_math_function(name = "fminf")
1849-
18501844
libc_math_function(name = "fminl")
1845+
libc_math_function(name = "fminf128")
18511846

18521847
libc_math_function(name = "fmax")
1853-
18541848
libc_math_function(name = "fmaxf")
1855-
18561849
libc_math_function(name = "fmaxl")
1850+
libc_math_function(name = "fmaxf128")
18571851

18581852
libc_math_function(
18591853
name = "cosf",
@@ -1927,49 +1921,47 @@ libc_math_function(
19271921
],
19281922
)
19291923

1930-
libc_math_function(name = "copysign")
1924+
libc_math_function(
1925+
name = "sqrtf128",
1926+
additional_deps = [
1927+
":__support_fputil_sqrt",
1928+
],
1929+
)
19311930

1931+
libc_math_function(name = "copysign")
19321932
libc_math_function(name = "copysignf")
1933-
19341933
libc_math_function(name = "copysignl")
1935-
19361934
libc_math_function(name = "copysignf128")
19371935

19381936
libc_math_function(name = "ilogb")
1939-
19401937
libc_math_function(name = "ilogbf")
1941-
19421938
libc_math_function(name = "ilogbl")
1939+
libc_math_function(name = "ilogbf128")
19431940

19441941
libc_math_function(name = "rint")
1945-
19461942
libc_math_function(name = "rintf")
1947-
19481943
libc_math_function(name = "rintl")
1944+
libc_math_function(name = "rintf128")
19491945

19501946
libc_math_function(name = "lrint")
1951-
19521947
libc_math_function(name = "lrintf")
1953-
19541948
libc_math_function(name = "lrintl")
1949+
libc_math_function(name = "lrintf128")
19551950

19561951
libc_math_function(name = "llrint")
1957-
19581952
libc_math_function(name = "llrintf")
1959-
19601953
libc_math_function(name = "llrintl")
1954+
libc_math_function(name = "llrintf128")
19611955

19621956
libc_math_function(name = "lround")
1963-
19641957
libc_math_function(name = "lroundf")
1965-
19661958
libc_math_function(name = "lroundl")
1959+
libc_math_function(name = "lroundf128")
19671960

19681961
libc_math_function(name = "llround")
1969-
19701962
libc_math_function(name = "llroundf")
1971-
19721963
libc_math_function(name = "llroundl")
1964+
libc_math_function(name = "llroundf128")
19731965

19741966
libc_math_function(
19751967
name = "nan",
@@ -1995,28 +1987,29 @@ libc_math_function(
19951987
],
19961988
)
19971989

1998-
libc_math_function(name = "nearbyint")
1990+
libc_math_function(
1991+
name = "nanf128",
1992+
additional_deps = [
1993+
":__support_str_to_float",
1994+
":errno",
1995+
],
1996+
)
19991997

1998+
libc_math_function(name = "nearbyint")
20001999
libc_math_function(name = "nearbyintf")
2001-
20022000
libc_math_function(name = "nearbyintl")
20032001

20042002
libc_math_function(name = "nextafter")
2005-
20062003
libc_math_function(name = "nextafterf")
2007-
20082004
libc_math_function(name = "nextafterl")
2005+
libc_math_function(name = "nextafterf128")
20092006

20102007
libc_math_function(name = "nexttoward")
2011-
20122008
libc_math_function(name = "nexttowardf")
2013-
20142009
libc_math_function(name = "nexttowardl")
20152010

20162011
libc_math_function(name = "scalbn")
2017-
20182012
libc_math_function(name = "scalbnf")
2019-
20202013
libc_math_function(name = "scalbnl")
20212014

20222015
############################## inttypes targets ##############################
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
# Smoke tests for LLVM libc math.h functions.
6+
7+
load("//libc:libc_build_rules.bzl", "libc_support_library")
8+
load("//libc/test/src/math:libc_math_test_rules.bzl", "math_test")
9+
10+
package(default_visibility = ["//visibility:public"])
11+
12+
licenses(["notice"])
13+
14+
math_test(
15+
name = "fabsf128",
16+
hdrs = ["FAbsTest.h"],
17+
)
18+
19+
math_test(
20+
name = "ceilf128",
21+
hdrs = ["CeilTest.h"],
22+
)
23+
24+
math_test(
25+
name = "floorf128",
26+
hdrs = ["FloorTest.h"],
27+
)
28+
29+
math_test(
30+
name = "truncf128",
31+
hdrs = ["TruncTest.h"],
32+
)
33+
34+
math_test(
35+
name = "roundf128",
36+
hdrs = ["RoundTest.h"],
37+
)
38+
39+
math_test(
40+
name = "frexpf128",
41+
hdrs = ["FrexpTest.h"],
42+
)
43+
44+
math_test(
45+
name = "logbf128",
46+
hdrs = ["LogbTest.h"],
47+
)
48+
49+
math_test(
50+
name = "modff128",
51+
hdrs = ["ModfTest.h"],
52+
)
53+
54+
math_test(
55+
name = "fminf128",
56+
hdrs = ["FMinTest.h"],
57+
)
58+
59+
math_test(
60+
name = "fmaxf128",
61+
hdrs = ["FMaxTest.h"],
62+
)
63+
64+
math_test(
65+
name = "sqrtf128",
66+
hdrs = ["SqrtTest.h"],
67+
deps = ["//libc:__support_cpp_bit"],
68+
)
69+
70+
math_test(
71+
name = "copysignf128",
72+
hdrs = ["CopySignTest.h"],
73+
)
74+
75+
math_test(
76+
name = "ilogbf128",
77+
hdrs = ["ILogbTest.h"],
78+
deps = ["//libc:__support_cpp_limits"],
79+
)
80+
81+
math_test(
82+
name = "fdimf128",
83+
hdrs = ["FDimTest.h"],
84+
)
85+
86+
libc_support_library(
87+
name = "ldexp_test_template",
88+
hdrs = ["LdExpTest.h"],
89+
deps = [
90+
"//libc:__support_cpp_limits",
91+
"//libc:__support_fputil_fp_bits",
92+
"//libc:__support_fputil_normal_float",
93+
"//libc:llvm_libc_macros_math_macros",
94+
"//libc/test/UnitTest:LibcUnitTest",
95+
"//libc/test/UnitTest:fp_test_helpers",
96+
],
97+
)
98+
99+
math_test(
100+
name = "ldexpf128",
101+
hdrs = ["LdExpTest.h"],
102+
deps = ["//libc:__support_cpp_limits"],
103+
)
104+
105+
math_test(
106+
name = "rintf128",
107+
hdrs = ["RIntTest.h"],
108+
)
109+
110+
math_test(
111+
name = "lrintf128",
112+
hdrs = ["RoundToIntegerTest.h"],
113+
)
114+
115+
math_test(
116+
name = "llrintf128",
117+
hdrs = ["RoundToIntegerTest.h"],
118+
)
119+
math_test(
120+
name = "lroundf128",
121+
hdrs = ["RoundToIntegerTest.h"],
122+
)
123+
124+
math_test(
125+
name = "llroundf128",
126+
hdrs = ["RoundToIntegerTest.h"],
127+
)
128+
129+
libc_support_library(
130+
name = "nextafter_test_template",
131+
hdrs = ["NextAfterTest.h"],
132+
deps = [
133+
"//libc:__support_cpp_array",
134+
"//libc:__support_cpp_bit",
135+
"//libc:__support_cpp_type_traits",
136+
"//libc:__support_fputil_basic_operations",
137+
"//libc:__support_fputil_fp_bits",
138+
"//libc:llvm_libc_macros_math_macros",
139+
"//libc/test/UnitTest:LibcUnitTest",
140+
"//libc/test/UnitTest:fp_test_helpers",
141+
],
142+
)
143+
144+
math_test(
145+
name = "nextafterf128",
146+
deps = [":nextafter_test_template"],
147+
)

0 commit comments

Comments
 (0)