[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 11:51:16 PDT 2026
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/224854
This fixes mathvec tests failures on amdgpu for https://github.com/llvm/llvm-project/pull/224735.
>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] [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 1a49297a5d9dc8..51ff9da914cac5 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 1d986125bff19d..adf6f5ff57b33d 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 bd1cb3dce7055d..0d4e05410879f5 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 c7551b37df9884..b678040951c70e 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 302298b5f0a5a9..f1b23786bfc309 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 90984f64899827..a66cd0280122c5 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 2b6504c62d9b33..770a4c6fef893b 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 ecb9fcfad8b0f6..18b6b398b5b6cd 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;
More information about the libc-commits
mailing list