public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1075] libstdc++: Resolve -Wunused-variable warnings in stdx::simd and tests
@ 2023-05-22 15:31 Matthias Kretz
0 siblings, 0 replies; only message in thread
From: Matthias Kretz @ 2023-05-22 15:31 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:a7129e82bed1bd4f513fc3c3f401721e2c96a865
commit r14-1075-ga7129e82bed1bd4f513fc3c3f401721e2c96a865
Author: Matthias Kretz <m.kretz@gsi.de>
Date: Mon May 22 16:58:30 2023 +0200
libstdc++: Resolve -Wunused-variable warnings in stdx::simd and tests
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd_builtin.h (_S_fpclassify): Move
__infn into #ifdef'ed block.
* testsuite/experimental/simd/tests/fpclassify.cc: Declare
constants only when used.
* testsuite/experimental/simd/tests/frexp.cc: Likewise.
* testsuite/experimental/simd/tests/logarithm.cc: Likewise.
* testsuite/experimental/simd/tests/trunc_ceil_floor.cc:
Likewise.
* testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc:
Move totest and expect1 into #ifdef'ed block.
Diff:
---
libstdc++-v3/include/experimental/bits/simd_builtin.h | 4 ++--
libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc | 2 ++
libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc | 6 ++++++
.../testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc | 4 ++--
libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc | 4 +++-
libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc | 2 ++
6 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/include/experimental/bits/simd_builtin.h b/libstdc++-v3/include/experimental/bits/simd_builtin.h
index 4c008da26e0..3d52bc6c96a 100644
--- a/libstdc++-v3/include/experimental/bits/simd_builtin.h
+++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h
@@ -2370,12 +2370,12 @@ template <typename _Abi, typename>
constexpr size_t _NI = sizeof(__xn) / sizeof(_I);
_GLIBCXX_SIMD_USE_CONSTEXPR auto __minn
= __vector_bitcast<_I>(__vector_broadcast<_NI>(__norm_min_v<_Tp>));
- _GLIBCXX_SIMD_USE_CONSTEXPR auto __infn
- = __vector_bitcast<_I>(__vector_broadcast<_NI>(__infinity_v<_Tp>));
_GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_normal
= __vector_broadcast<_NI, _I>(FP_NORMAL);
#if !__FINITE_MATH_ONLY__
+ _GLIBCXX_SIMD_USE_CONSTEXPR auto __infn
+ = __vector_bitcast<_I>(__vector_broadcast<_NI>(__infinity_v<_Tp>));
_GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_nan
= __vector_broadcast<_NI, _I>(FP_NAN);
_GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_infinite
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc b/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc
index 00c608f9530..13262df80ac 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc
@@ -38,9 +38,11 @@ template <typename V>
{
using T = typename V::value_type;
using intv = std::experimental::fixed_size_simd<int, V::size()>;
+#if __GCC_IEC_559 >= 2
constexpr T inf = std::__infinity_v<T>;
constexpr T denorm_min = std::__infinity_v<T>;
constexpr T nan = std::__quiet_NaN_v<T>;
+#endif
constexpr T max = std::__finite_max_v<T>;
constexpr T norm_min = std::__norm_min_v<T>;
test_values<V>(
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc b/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc
index f6a47cedd13..2c3f500beee 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc
@@ -25,11 +25,17 @@ template <typename V>
{
using int_v = std::experimental::fixed_size_simd<int, V::size()>;
using T = typename V::value_type;
+#if __GCC_IEC_559 >= 2 || defined __STDC_IEC_559__
constexpr auto denorm_min = std::__denorm_min_v<T>;
+#endif
+#if __GCC_IEC_559 >= 2
constexpr auto norm_min = std::__norm_min_v<T>;
+#endif
constexpr auto max = std::__finite_max_v<T>;
+#if defined __STDC_IEC_559__
constexpr auto nan = std::__quiet_NaN_v<T>;
constexpr auto inf = std::__infinity_v<T>;
+#endif
test_values<V>(
{0, 0.25, 0.5, 1, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 31, -0., -0.25, -0.5, -1,
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc b/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc
index 0fb1338fc04..56e275ee4bf 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc
@@ -137,7 +137,6 @@ template <typename V>
if (modf_is_broken)
return;
V integral = {};
- const V totest = modf(input, &integral);
auto&& expected = [&](const auto& v) -> std::pair<const V, const V> {
std::pair<V, V> tmp = {};
using std::modf;
@@ -149,8 +148,9 @@ template <typename V>
}
return tmp;
};
- const auto expect1 = expected(input);
#ifdef __STDC_IEC_559__
+ const V totest = modf(input, &integral);
+ const auto expect1 = expected(input);
COMPARE(isnan(totest), isnan(expect1.first))
<< "modf(" << input << ", iptr) = " << totest << " != " << expect1;
COMPARE(isnan(integral), isnan(expect1.second))
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc b/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc
index 31ad1499e00..a4a46c95800 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc
@@ -27,11 +27,13 @@ template <typename V>
vir::test::setFuzzyness<double>(1);
using T = typename V::value_type;
+#ifdef __STDC_IEC_559__
constexpr T nan = std::__quiet_NaN_v<T>;
constexpr T inf = std::__infinity_v<T>;
constexpr T denorm_min = std::__denorm_min_v<T>;
- constexpr T norm_min = std::__norm_min_v<T>;
constexpr T min = std::__finite_min_v<T>;
+#endif
+ constexpr T norm_min = std::__norm_min_v<T>;
constexpr T max = std::__finite_max_v<T>;
test_values<V>({1,
2,
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc b/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc
index ecbc1481600..f2ef8088f73 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc
@@ -24,8 +24,10 @@ template <typename V>
test()
{
using T = typename V::value_type;
+#ifdef __STDC_IEC_559__
constexpr T inf = std::__infinity_v<T>;
constexpr T denorm_min = std::__denorm_min_v<T>;
+#endif
constexpr T norm_min = std::__norm_min_v<T>;
constexpr T max = std::__finite_max_v<T>;
constexpr T min = std::__finite_min_v<T>;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-22 15:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 15:31 [gcc r14-1075] libstdc++: Resolve -Wunused-variable warnings in stdx::simd and tests Matthias Kretz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).