Skip to content

Commit 3a228a3

Browse files
[libc][bazel] Main f16 test targets, new f16 funcs (#130208)
This patch adds acosf16 and asinf16 which I missed last patch, and also the primary math tests for the float16 functions.
1 parent 78631ac commit 3a228a3

File tree

3 files changed

+196
-0
lines changed

3 files changed

+196
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,6 +2198,20 @@ libc_math_function(
21982198
],
21992199
)
22002200

2201+
libc_math_function(
2202+
name = "acosf16",
2203+
additional_deps = [
2204+
":__support_fputil_cast",
2205+
":__support_fputil_fma",
2206+
":__support_fputil_multiply_add",
2207+
":__support_fputil_nearest_integer",
2208+
":__support_fputil_polyeval",
2209+
":__support_fputil_sqrt",
2210+
":__support_macros_optimization",
2211+
":inv_trigf_utils",
2212+
],
2213+
)
2214+
22012215
libc_math_function(
22022216
name = "acoshf",
22032217
additional_deps = [
@@ -2226,6 +2240,20 @@ libc_math_function(
22262240
],
22272241
)
22282242

2243+
libc_math_function(
2244+
name = "asinf16",
2245+
additional_deps = [
2246+
":__support_fputil_cast",
2247+
":__support_fputil_fma",
2248+
":__support_fputil_multiply_add",
2249+
":__support_fputil_nearest_integer",
2250+
":__support_fputil_polyeval",
2251+
":__support_fputil_sqrt",
2252+
":__support_macros_optimization",
2253+
":inv_trigf_utils",
2254+
],
2255+
)
2256+
22292257
libc_math_function(
22302258
name = "asinhf",
22312259
additional_deps = [

utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ math_mpfr_test(
4747
hdrs = ["CeilTest.h"],
4848
)
4949

50+
math_mpfr_test(
51+
name = "ceilf16",
52+
hdrs = ["CeilTest.h"],
53+
)
54+
5055
math_mpfr_test(name = "cos")
5156

5257
math_mpfr_test(
@@ -144,6 +149,21 @@ math_mpfr_test(
144149
hdrs = ["AddTest.h"],
145150
)
146151

152+
math_mpfr_test(
153+
name = "f16add",
154+
hdrs = ["AddTest.h"],
155+
)
156+
157+
math_mpfr_test(
158+
name = "f16addf",
159+
hdrs = ["AddTest.h"],
160+
)
161+
162+
math_mpfr_test(
163+
name = "f16addl",
164+
hdrs = ["AddTest.h"],
165+
)
166+
147167
math_mpfr_test(
148168
name = "fdiv",
149169
hdrs = ["DivTest.h"],
@@ -154,6 +174,21 @@ math_mpfr_test(
154174
hdrs = ["DivTest.h"],
155175
)
156176

177+
math_mpfr_test(
178+
name = "f16div",
179+
hdrs = ["DivTest.h"],
180+
)
181+
182+
math_mpfr_test(
183+
name = "f16divf",
184+
hdrs = ["DivTest.h"],
185+
)
186+
187+
math_mpfr_test(
188+
name = "f16divl",
189+
hdrs = ["DivTest.h"],
190+
)
191+
157192
# TODO: Add ffma, ffmal test. Missing stdlib/rand dependency.
158193

159194
math_mpfr_test(
@@ -171,8 +206,21 @@ math_mpfr_test(
171206
hdrs = ["FloorTest.h"],
172207
)
173208

209+
math_mpfr_test(
210+
name = "floorf16",
211+
hdrs = ["FloorTest.h"],
212+
)
213+
174214
# TODO: Add fma, fmaf, fmal, fmul, fmull tests. Missing stdlib/rand dependency.
175215

216+
# math_mpfr_test(name = "f16mul")
217+
# math_mpfr_test(name = "f16mulf")
218+
# math_mpfr_test(name = "f16mull")
219+
220+
# math_mpfr_test(name = "f16fma")
221+
# math_mpfr_test(name = "f16fmaf")
222+
# math_mpfr_test(name = "f16fmal")
223+
176224
math_mpfr_test(
177225
name = "frexp",
178226
hdrs = ["FrexpTest.h"],
@@ -208,6 +256,21 @@ math_mpfr_test(
208256
hdrs = ["SubTest.h"],
209257
)
210258

259+
math_mpfr_test(
260+
name = "f16sub",
261+
hdrs = ["SubTest.h"],
262+
)
263+
264+
math_mpfr_test(
265+
name = "f16subf",
266+
hdrs = ["SubTest.h"],
267+
)
268+
269+
math_mpfr_test(
270+
name = "f16subl",
271+
hdrs = ["SubTest.h"],
272+
)
273+
211274
math_mpfr_test(
212275
name = "hypot",
213276
hdrs = ["HypotTest.h"],
@@ -236,6 +299,11 @@ math_mpfr_test(
236299
hdrs = ["RoundToIntegerTest.h"],
237300
)
238301

302+
math_mpfr_test(
303+
name = "llrintf16",
304+
hdrs = ["RoundToIntegerTest.h"],
305+
)
306+
239307
math_mpfr_test(
240308
name = "llround",
241309
hdrs = ["RoundToIntegerTest.h"],
@@ -251,6 +319,16 @@ math_mpfr_test(
251319
hdrs = ["RoundToIntegerTest.h"],
252320
)
253321

322+
math_mpfr_test(
323+
name = "lroundf16",
324+
hdrs = ["RoundToIntegerTest.h"],
325+
)
326+
327+
math_mpfr_test(
328+
name = "llroundf16",
329+
hdrs = ["RoundToIntegerTest.h"],
330+
)
331+
254332
math_mpfr_test(name = "log")
255333

256334
math_mpfr_test(name = "logf")
@@ -282,6 +360,11 @@ math_mpfr_test(
282360
hdrs = ["RoundToIntegerTest.h"],
283361
)
284362

363+
math_mpfr_test(
364+
name = "lrintf16",
365+
hdrs = ["RoundToIntegerTest.h"],
366+
)
367+
285368
math_mpfr_test(
286369
name = "lround",
287370
hdrs = ["RoundToIntegerTest.h"],
@@ -323,6 +406,14 @@ math_mpfr_test(
323406
],
324407
)
325408

409+
math_mpfr_test(
410+
name = "nearbyintf16",
411+
hdrs = ["NearbyIntTest.h"],
412+
deps = [
413+
"//libc:__support_cpp_array",
414+
],
415+
)
416+
326417
math_mpfr_test(name = "pow")
327418

328419
math_mpfr_test(name = "powf")
@@ -357,6 +448,11 @@ math_mpfr_test(
357448
hdrs = ["RIntTest.h"],
358449
)
359450

451+
math_mpfr_test(
452+
name = "rintf16",
453+
hdrs = ["RIntTest.h"],
454+
)
455+
360456
math_mpfr_test(
361457
name = "roundeven",
362458
hdrs = ["RoundEvenTest.h"],
@@ -372,6 +468,11 @@ math_mpfr_test(
372468
hdrs = ["RoundEvenTest.h"],
373469
)
374470

471+
math_mpfr_test(
472+
name = "roundevenf16",
473+
hdrs = ["RoundEvenTest.h"],
474+
)
475+
375476
math_mpfr_test(
376477
name = "round",
377478
hdrs = ["RoundTest.h"],
@@ -387,6 +488,11 @@ math_mpfr_test(
387488
hdrs = ["RoundTest.h"],
388489
)
389490

491+
math_mpfr_test(
492+
name = "roundf16",
493+
hdrs = ["RoundTest.h"],
494+
)
495+
390496
math_mpfr_test(name = "sin")
391497

392498
math_mpfr_test(
@@ -437,6 +543,21 @@ math_mpfr_test(
437543
hdrs = ["SqrtTest.h"],
438544
)
439545

546+
math_mpfr_test(
547+
name = "f16sqrt",
548+
hdrs = ["SqrtTest.h"],
549+
)
550+
551+
math_mpfr_test(
552+
name = "f16sqrtf",
553+
hdrs = ["SqrtTest.h"],
554+
)
555+
556+
math_mpfr_test(
557+
name = "f16sqrtl",
558+
hdrs = ["SqrtTest.h"],
559+
)
560+
440561
math_mpfr_test(name = "tan")
441562

442563
math_mpfr_test(
@@ -463,3 +584,46 @@ math_mpfr_test(
463584
name = "truncl",
464585
hdrs = ["TruncTest.h"],
465586
)
587+
588+
math_mpfr_test(
589+
name = "truncf16",
590+
hdrs = ["TruncTest.h"],
591+
)
592+
593+
math_mpfr_test(name = "cosf16")
594+
595+
math_mpfr_test(name = "cospif16")
596+
597+
math_mpfr_test(name = "sinf16")
598+
599+
math_mpfr_test(name = "sinpif16")
600+
601+
math_mpfr_test(name = "tanf16")
602+
603+
math_mpfr_test(name = "tanpif16")
604+
605+
math_mpfr_test(name = "expf16")
606+
607+
math_mpfr_test(name = "exp2f16")
608+
609+
math_mpfr_test(name = "exp2m1f16")
610+
611+
math_mpfr_test(name = "exp10f16")
612+
613+
math_mpfr_test(name = "exp10m1f16")
614+
615+
math_mpfr_test(name = "asinf16")
616+
617+
math_mpfr_test(name = "acosf16")
618+
619+
math_mpfr_test(name = "coshf16")
620+
621+
math_mpfr_test(name = "sinhf16")
622+
623+
math_mpfr_test(name = "tanhf16")
624+
625+
math_mpfr_test(name = "logf16")
626+
627+
math_mpfr_test(name = "log2f16")
628+
629+
math_mpfr_test(name = "log10f16")

utils/bazel/llvm-project-overlay/libc/test/src/math/smoke/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ math_test(name = "acosf")
1414

1515
math_test(name = "acoshf")
1616

17+
math_test(name = "acosf16")
18+
1719
math_test(name = "asinf")
1820

21+
math_test(name = "asinf16")
22+
1923
math_test(name = "asinhf")
2024

2125
math_test(name = "atan2")

0 commit comments

Comments
 (0)