diff options
author | Matthias Kretz <m.kretz@gsi.de> | 2023-05-22 16:58:30 +0200 |
---|---|---|
committer | Matthias Kretz <m.kretz@gsi.de> | 2023-05-22 17:30:44 +0200 |
commit | a7129e82bed1bd4f513fc3c3f401721e2c96a865 (patch) | |
tree | badabb7a5326ea126d548237e3819a1de95f94ef | |
parent | 9f5065094c9632a50bea604d5896a139609e50cf (diff) | |
download | gcc-a7129e82bed1bd4f513fc3c3f401721e2c96a865.zip gcc-a7129e82bed1bd4f513fc3c3f401721e2c96a865.tar.gz gcc-a7129e82bed1bd4f513fc3c3f401721e2c96a865.tar.bz2 |
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.
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 4c008da..3d52bc6 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 00c608f..13262df 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 f6a47ce..2c3f500 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 0fb1338..56e275e 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 31ad149..a4a46c95 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 ecbc148..f2ef808 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>; |