The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cb82cc9f0e3bdf2b39734851c74b9a13edb0cbdc
commit cb82cc9f0e3bdf2b39734851c74b9a13edb0cbdc Author: Steve Kargl <[email protected]> AuthorDate: 2026-09-10 23:33:14 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-09-11 17:53:08 +0000 lib/msun: add tests for fmaf(3) subnormals PR: 298260 Reviewed by: kib MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59579 --- lib/msun/tests/fma_test.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/msun/tests/fma_test.c b/lib/msun/tests/fma_test.c index ec57fc34c1b1..1c63f1fd0f89 100644 --- a/lib/msun/tests/fma_test.c +++ b/lib/msun/tests/fma_test.c @@ -538,6 +538,30 @@ ATF_TC_BODY(double_rounding, tc) { test_double_rounding(); } +ATF_TC_WITHOUT_HEAD(fmaf_subnormals); +ATF_TC_BODY(fmaf_subnormals, tc) { + float x, y, z; + float f1, f2; + + x = -0x1.001p-81f, y = 0x1.ffe002p-70f, z = 0x1.0002p-133f; + f1 = fmaf(x, y, z); + f2 = 0x1.0001p-133; + printf("fmaf: %a %s\n", f1, " expecting 0x1.0001p-133"); + ATF_CHECK_MSG(f1 == f2, "%a %a", f1, f2); + + x = -0x1.26524ep-54f, y = -0x1.cb7868p+11f, z = 0x1.d10f5ep-29f; + f1 = fmaf(x, y, z); + f2 = 0x1.d1179ep-29; + printf("fmaf: %a, %s\n", f1, "expecting 0x1.d1179ep-29"); + ATF_CHECK_MSG(f1 == f2, "%a %a", f1, f2); + + x = 0x1p-120f, y = 0x1p-120f, z = 0x1p-149f; + f1 = fmaf(x, y, z); + f2 = 0x1p-149; + printf("fmaf: %a, %s\n", f1, " expecting 0x1p-149"); + ATF_CHECK_MSG(f1 == f2, "%a %a", f1, f2); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, zeroes); @@ -547,9 +571,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, big_z); ATF_TP_ADD_TC(tp, accuracy); ATF_TP_ADD_TC(tp, double_rounding); + ATF_TP_ADD_TC(tp, fmaf_subnormals); + /* * TODO: - * - Tests for subnormals + * - Tests for subnormals for fma * - Cancellation tests (e.g., z = (double)x*y, but x*y is inexact) */ return (atf_no_error());
