[libc-commits] [libc] [libc][mathvec] Explicitly test against scalar double precision versions for exp*f. (PR #224854)
via libc-commits
libc-commits at lists.llvm.org
Sat Sep 19 12:20:25 PDT 2026
https://github.com/lntue updated https://github.com/llvm/llvm-project/pull/224854
>From ca07f4d83591f4a575ee878d9b1e1550ee564e09 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Sat, 19 Sep 2026 18:48:20 +0000
Subject: [PATCH 1/2] [libc][mathvec] Explicitly test against scalar double
precision versions for exp*f.
---
libc/test/src/mathvec/CMakeLists.txt | 6 +++---
libc/test/src/mathvec/exhaustive/CMakeLists.txt | 6 +++---
libc/test/src/mathvec/exhaustive/exp10f_test.cpp | 7 +++----
libc/test/src/mathvec/exhaustive/exp2f_test.cpp | 7 +++----
libc/test/src/mathvec/exhaustive/expf_test.cpp | 7 +++----
libc/test/src/mathvec/exp10f_test.cpp | 7 +++----
libc/test/src/mathvec/exp2f_test.cpp | 7 +++----
libc/test/src/mathvec/expf_test.cpp | 7 +++----
8 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/libc/test/src/mathvec/CMakeLists.txt b/libc/test/src/mathvec/CMakeLists.txt
index 1a49297a5d9dc..51ff9da914cac 100644
--- a/libc/test/src/mathvec/CMakeLists.txt
+++ b/libc/test/src/mathvec/CMakeLists.txt
@@ -241,7 +241,7 @@ add_fp_unittest(
exp2f_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.math.exp2f
+ libc.src.__support.math.exp2f_double_eval
libc.src.mathvec.exp2f
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
@@ -275,7 +275,7 @@ add_fp_unittest(
exp10f_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.math.exp10f
+ libc.src.__support.math.exp10f_double_eval
libc.src.mathvec.exp10f
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
@@ -309,7 +309,7 @@ add_fp_unittest(
expf_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.math.expf
+ libc.src.__support.math.expf_double_eval
libc.src.mathvec.expf
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
diff --git a/libc/test/src/mathvec/exhaustive/CMakeLists.txt b/libc/test/src/mathvec/exhaustive/CMakeLists.txt
index 1d986125bff19..adf6f5ff57b33 100644
--- a/libc/test/src/mathvec/exhaustive/CMakeLists.txt
+++ b/libc/test/src/mathvec/exhaustive/CMakeLists.txt
@@ -226,7 +226,7 @@ add_fp_unittest(
exp2f_test.cpp
DEPENDS
.exhaustive_test
- libc.src.math.exp2f
+ libc.src.__support.math.exp2f_double_eval
libc.src.mathvec.exp2f
libc.src.__support.CPP.simd
LINK_LIBRARIES
@@ -258,7 +258,7 @@ add_fp_unittest(
exp10f_test.cpp
DEPENDS
.exhaustive_test
- libc.src.math.exp10f
+ libc.src.__support.math.exp10f_double_eval
libc.src.mathvec.exp10f
libc.src.__support.CPP.simd
LINK_LIBRARIES
@@ -290,7 +290,7 @@ add_fp_unittest(
expf_test.cpp
DEPENDS
.exhaustive_test
- libc.src.math.expf
+ libc.src.__support.math.expf_double_eval
libc.src.mathvec.expf
libc.src.__support.CPP.simd
LINK_LIBRARIES
diff --git a/libc/test/src/mathvec/exhaustive/exp10f_test.cpp b/libc/test/src/mathvec/exhaustive/exp10f_test.cpp
index bd1cb3dce7055..0d4e05410879f 100644
--- a/libc/test/src/mathvec/exhaustive/exp10f_test.cpp
+++ b/libc/test/src/mathvec/exhaustive/exp10f_test.cpp
@@ -13,12 +13,11 @@
#include "exhaustive_test.h"
#include "src/__support/CPP/simd.h"
-#include "src/math/exp10f.h"
+#include "src/__support/math/exp10f_double_eval.h"
#include "src/mathvec/exp10f.h"
-using LlvmLibcExp10fExhaustiveTest =
- LlvmLibcUnaryOpExhaustiveMathvecTest<float, LIBC_NAMESPACE::exp10f,
- LIBC_NAMESPACE::exp10f>;
+using LlvmLibcExp10fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathvecTest<
+ float, LIBC_NAMESPACE::math::double_eval::exp10f, LIBC_NAMESPACE::exp10f>;
// Tests all possible 32-bit input patterns
TEST_F(LlvmLibcExp10fExhaustiveTest, EntireRange) { test_full_range_RN(); }
diff --git a/libc/test/src/mathvec/exhaustive/exp2f_test.cpp b/libc/test/src/mathvec/exhaustive/exp2f_test.cpp
index c7551b37df988..b678040951c70 100644
--- a/libc/test/src/mathvec/exhaustive/exp2f_test.cpp
+++ b/libc/test/src/mathvec/exhaustive/exp2f_test.cpp
@@ -13,12 +13,11 @@
#include "exhaustive_test.h"
#include "src/__support/CPP/simd.h"
-#include "src/math/exp2f.h"
+#include "src/__support/math/exp2f_double_eval.h"
#include "src/mathvec/exp2f.h"
-using LlvmLibcExp2fExhaustiveTest =
- LlvmLibcUnaryOpExhaustiveMathvecTest<float, LIBC_NAMESPACE::exp2f,
- LIBC_NAMESPACE::exp2f>;
+using LlvmLibcExp2fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathvecTest<
+ float, LIBC_NAMESPACE::math::double_eval::exp2f, LIBC_NAMESPACE::exp2f>;
// Tests all possible 32-bit input patterns
TEST_F(LlvmLibcExp2fExhaustiveTest, EntireRange) { test_full_range_RN(); }
diff --git a/libc/test/src/mathvec/exhaustive/expf_test.cpp b/libc/test/src/mathvec/exhaustive/expf_test.cpp
index 302298b5f0a5a..f1b23786bfc30 100644
--- a/libc/test/src/mathvec/exhaustive/expf_test.cpp
+++ b/libc/test/src/mathvec/exhaustive/expf_test.cpp
@@ -13,12 +13,11 @@
#include "exhaustive_test.h"
#include "src/__support/CPP/simd.h"
-#include "src/math/expf.h"
+#include "src/__support/math/expf_double_eval.h"
#include "src/mathvec/expf.h"
-using LlvmLibcExpfExhaustiveTest =
- LlvmLibcUnaryOpExhaustiveMathvecTest<float, LIBC_NAMESPACE::expf,
- LIBC_NAMESPACE::expf>;
+using LlvmLibcExpfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathvecTest<
+ float, LIBC_NAMESPACE::math::double_eval::expf, LIBC_NAMESPACE::expf>;
// Tests all possible 32-bit input patterns
TEST_F(LlvmLibcExpfExhaustiveTest, EntireRange) { test_full_range_RN(); }
diff --git a/libc/test/src/mathvec/exp10f_test.cpp b/libc/test/src/mathvec/exp10f_test.cpp
index 90984f6489982..a66cd0280122c 100644
--- a/libc/test/src/mathvec/exp10f_test.cpp
+++ b/libc/test/src/mathvec/exp10f_test.cpp
@@ -14,7 +14,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/simd.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/math/exp10f.h"
+#include "src/__support/math/exp10f_double_eval.h"
#include "src/mathvec/exp10f.h"
#include "test/UnitTest/Test.h"
#include "test/src/mathvec/UnitTestWrappers.h"
@@ -23,9 +23,8 @@
using LlvmLibcVecExp10fTest = LIBC_NAMESPACE::testing::FPTest<float>;
-using Exp10fOp =
- LIBC_NAMESPACE::testing::mathvec::UnaryOp<float, LIBC_NAMESPACE::exp10f,
- LIBC_NAMESPACE::exp10f>;
+using Exp10fOp = LIBC_NAMESPACE::testing::mathvec::UnaryOp<
+ float, LIBC_NAMESPACE::math::double_eval::exp10f, LIBC_NAMESPACE::exp10f>;
using LIBC_NAMESPACE::cpp::splat;
using LIBC_NAMESPACE::testing::mathvec::wrap_ref;
using LIBC_NAMESPACE::testing::mathvec::wrap_vector;
diff --git a/libc/test/src/mathvec/exp2f_test.cpp b/libc/test/src/mathvec/exp2f_test.cpp
index 2b6504c62d9b3..770a4c6fef893 100644
--- a/libc/test/src/mathvec/exp2f_test.cpp
+++ b/libc/test/src/mathvec/exp2f_test.cpp
@@ -14,7 +14,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/simd.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/math/exp2f.h"
+#include "src/__support/math/exp2f_double_eval.h"
#include "src/mathvec/exp2f.h"
#include "test/UnitTest/Test.h"
#include "test/src/mathvec/UnitTestWrappers.h"
@@ -23,9 +23,8 @@
using LlvmLibcVecExp2fTest = LIBC_NAMESPACE::testing::FPTest<float>;
-using Exp2fOp =
- LIBC_NAMESPACE::testing::mathvec::UnaryOp<float, LIBC_NAMESPACE::exp2f,
- LIBC_NAMESPACE::exp2f>;
+using Exp2fOp = LIBC_NAMESPACE::testing::mathvec::UnaryOp<
+ float, LIBC_NAMESPACE::math::double_eval::exp2f, LIBC_NAMESPACE::exp2f>;
using LIBC_NAMESPACE::cpp::splat;
using LIBC_NAMESPACE::testing::mathvec::wrap_ref;
using LIBC_NAMESPACE::testing::mathvec::wrap_vector;
diff --git a/libc/test/src/mathvec/expf_test.cpp b/libc/test/src/mathvec/expf_test.cpp
index ecb9fcfad8b0f..18b6b398b5b6c 100644
--- a/libc/test/src/mathvec/expf_test.cpp
+++ b/libc/test/src/mathvec/expf_test.cpp
@@ -14,7 +14,7 @@
#include "hdr/math_macros.h"
#include "src/__support/CPP/simd.h"
#include "src/__support/FPUtil/FPBits.h"
-#include "src/math/expf.h"
+#include "src/__support/math/expf_double_eval.h"
#include "src/mathvec/expf.h"
#include "test/UnitTest/Test.h"
#include "test/src/mathvec/UnitTestWrappers.h"
@@ -23,9 +23,8 @@
using LlvmLibcVecExpfTest = LIBC_NAMESPACE::testing::FPTest<float>;
-using ExpfOp =
- LIBC_NAMESPACE::testing::mathvec::UnaryOp<float, LIBC_NAMESPACE::expf,
- LIBC_NAMESPACE::expf>;
+using ExpfOp = LIBC_NAMESPACE::testing::mathvec::UnaryOp<
+ float, LIBC_NAMESPACE::math::double_eval::expf, LIBC_NAMESPACE::expf>;
using LIBC_NAMESPACE::cpp::splat;
using LIBC_NAMESPACE::testing::mathvec::wrap_ref;
using LIBC_NAMESPACE::testing::mathvec::wrap_vector;
>From da61a65debc8c03357fcd7c8ef16f4cb2f9f8a81 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Sat, 19 Sep 2026 19:19:51 +0000
Subject: [PATCH 2/2] Fix cmake ordering.
---
libc/test/src/mathvec/CMakeLists.txt | 6 +++---
libc/test/src/mathvec/exhaustive/CMakeLists.txt | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libc/test/src/mathvec/CMakeLists.txt b/libc/test/src/mathvec/CMakeLists.txt
index 51ff9da914cac..85a3e09bd2252 100644
--- a/libc/test/src/mathvec/CMakeLists.txt
+++ b/libc/test/src/mathvec/CMakeLists.txt
@@ -241,8 +241,8 @@ add_fp_unittest(
exp2f_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.__support.math.exp2f_double_eval
libc.src.mathvec.exp2f
+ libc.src.__support.math.exp2f_double_eval
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
FLAGS
@@ -275,8 +275,8 @@ add_fp_unittest(
exp10f_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.__support.math.exp10f_double_eval
libc.src.mathvec.exp10f
+ libc.src.__support.math.exp10f_double_eval
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
FLAGS
@@ -309,8 +309,8 @@ add_fp_unittest(
expf_test.cpp
DEPENDS
.unit_test_wrappers
- libc.src.__support.math.expf_double_eval
libc.src.mathvec.expf
+ libc.src.__support.math.expf_double_eval
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.simd
FLAGS
diff --git a/libc/test/src/mathvec/exhaustive/CMakeLists.txt b/libc/test/src/mathvec/exhaustive/CMakeLists.txt
index adf6f5ff57b33..bebbb42164d49 100644
--- a/libc/test/src/mathvec/exhaustive/CMakeLists.txt
+++ b/libc/test/src/mathvec/exhaustive/CMakeLists.txt
@@ -226,8 +226,8 @@ add_fp_unittest(
exp2f_test.cpp
DEPENDS
.exhaustive_test
- libc.src.__support.math.exp2f_double_eval
libc.src.mathvec.exp2f
+ libc.src.__support.math.exp2f_double_eval
libc.src.__support.CPP.simd
LINK_LIBRARIES
-lpthread
@@ -258,8 +258,8 @@ add_fp_unittest(
exp10f_test.cpp
DEPENDS
.exhaustive_test
- libc.src.__support.math.exp10f_double_eval
libc.src.mathvec.exp10f
+ libc.src.__support.math.exp10f_double_eval
libc.src.__support.CPP.simd
LINK_LIBRARIES
-lpthread
@@ -290,8 +290,8 @@ add_fp_unittest(
expf_test.cpp
DEPENDS
.exhaustive_test
- libc.src.__support.math.expf_double_eval
libc.src.mathvec.expf
+ libc.src.__support.math.expf_double_eval
libc.src.__support.CPP.simd
LINK_LIBRARIES
-lpthread
More information about the libc-commits
mailing list