@@ -75,6 +75,7 @@ while [ $# -gt 0 ]; do
done
mkdir -p "$dst"
+pch="$dst/pch.h"
dst="$dst/Makefile"
if [ -f "$dst" ]; then
echo "Error: $dst already exists. Aborting." 1>&2
@@ -84,9 +85,23 @@ fi
CXX="$1"
shift
+cat >> "$pch" <<EOF
+#ifndef SIMD_PCH_
+#define SIMD_PCH_
+#include "${srcdir}/bits/verify.h"
+#include "${srcdir}/bits/make_vec.h"
+#include "${srcdir}/bits/mathreference.h"
+#include "${srcdir}/bits/metahelpers.h"
+#include "${srcdir}/bits/simd_view.h"
+#include "${srcdir}/bits/test_values.h"
+#include "${srcdir}/bits/ulp.h"
+#include "${srcdir}/bits/conversions.h"
+#endif // SIMD_PCH_
+EOF
+
echo "TESTFLAGS ?=" > "$dst"
echo "test_flags := $testflags \$(TESTFLAGS)" >> "$dst"
-echo CXXFLAGS = "$@" "\$(test_flags)" >> "$dst"
+echo CXXFLAGS = "$@" -include pch.h "\$(test_flags)" >> "$dst"
[ -n "$sim" ] && echo "export GCC_TEST_SIMULATOR = $sim" >> "$dst"
cat >> "$dst" <<EOF
srcdir = ${srcdir}
@@ -94,9 +109,14 @@ CXX = ${CXX}
DRIVER = ${driver}
DRIVEROPTS ?=
driveroptions := \$(DRIVEROPTS)
+PCH_DEPS := \$(shell \$(CXX) \$(CXXFLAGS) -M pch.h | sed -e 's/^.*://' -e 's/\\\\//g')
all: simd_testsuite.sum
+pch.h.gch: \$(PCH_DEPS)
+ @echo "Preparing pre-compiled header"
+ @\$(CXX) \$(CXXFLAGS) -c \$< -o \$@
+
simd_testsuite.sum: .progress .progress_total simd_testsuite.log
@printf "\n\t\t=== simd_testsuite \$(test_flags) Summary ===\n\n"\\
"# of expected passes:\t\t\$(shell grep -c '^PASS:' \$@)\n"\\
@@ -247,7 +267,7 @@ EOF
EOF
for i in $(seq 0 9); do
cat <<EOF
-%-$type-$i.log: \$(srcdir)/%.cc
+%-$type-$i.log: pch.h.gch \$(srcdir)/%.cc
@\$(DRIVER) \$(driveroptions) -t "$t" -a $i -n \$* \$(CXX) \$(CXXFLAGS)
EOF
@@ -16,11 +16,9 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
#include <cmath> // abs & sqrt
#include <cstdlib> // integer abs
-#include "bits/test_values.h"
template <typename V>
void
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <typename V>
void
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#ifndef SIMD_TESTS_BITS_CONVERSIONS_H_
+#define SIMD_TESTS_BITS_CONVERSIONS_H_
#include <array>
// is_conversion_undefined
@@ -86,22 +88,12 @@ template <typename To, typename T, typename A>
template <class T>
constexpr T
genHalfBits()
- { return std::__finite_max_v<T> >> (std::__digits_v<T> / 2); }
-
-template <>
- constexpr long double
- genHalfBits<long double>()
- { return 0; }
-
-template <>
- constexpr double
- genHalfBits<double>()
- { return 0; }
-
-template <>
- constexpr float
- genHalfBits<float>()
- { return 0; }
+ {
+ if constexpr (std::is_floating_point_v<T>)
+ return 0;
+ else
+ return std::__finite_max_v<T> >> (std::__digits_v<T> / 2);
+ }
template <class U, class T, class UU>
constexpr U
@@ -182,3 +174,4 @@ template <class T, class U>
operator[](size_t i) const
{ return cvt_input_data<U, T>[i]; }
};
+#endif // SIMD_TESTS_BITS_CONVERSIONS_H_
new file mode 100644
@@ -0,0 +1,87 @@
+// Copyright (C) 2020-2023 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef TESTS_BITS_MAIN_H_
+#define TESTS_BITS_MAIN_H_
+
+#include "verify.h"
+
+template <class T>
+ void
+ iterate_abis()
+ {
+ using namespace std::experimental::parallelism_v2;
+#ifndef EXTENDEDTESTS
+ invoke_test<simd<T, simd_abi::scalar>>(int());
+ invoke_test<simd<T, simd_abi::_VecBuiltin<16>>>(int());
+ invoke_test<simd<T, simd_abi::_VecBltnBtmsk<64>>>(int());
+#elif EXTENDEDTESTS == 0
+ invoke_test<simd<T, simd_abi::_VecBuiltin<8>>>(int());
+ invoke_test<simd<T, simd_abi::_VecBuiltin<12>>>(int());
+ invoke_test<simd<T, simd_abi::_VecBuiltin<24>>>(int());
+ invoke_test<simd<T, simd_abi::_VecBuiltin<32>>>(int());
+ invoke_test<simd<T, simd_abi::_VecBltnBtmsk<56>>>(int());
+#elif EXTENDEDTESTS == 1
+ invoke_test<simd<T, simd_abi::fixed_size<8>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<16>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<24>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<32>>>(int());
+#elif EXTENDEDTESTS == 2
+ invoke_test<simd<T, simd_abi::fixed_size<1>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<9>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<17>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<25>>>(int());
+#elif EXTENDEDTESTS == 3
+ invoke_test<simd<T, simd_abi::fixed_size<2>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<10>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<18>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<26>>>(int());
+#elif EXTENDEDTESTS == 4
+ invoke_test<simd<T, simd_abi::fixed_size<3>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<19>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<11>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<27>>>(int());
+#elif EXTENDEDTESTS == 5
+ invoke_test<simd<T, simd_abi::fixed_size<4>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<12>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<20>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<28>>>(int());
+#elif EXTENDEDTESTS == 6
+ invoke_test<simd<T, simd_abi::fixed_size<5>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<13>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<21>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<29>>>(int());
+#elif EXTENDEDTESTS == 7
+ invoke_test<simd<T, simd_abi::fixed_size<6>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<14>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<22>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<30>>>(int());
+#elif EXTENDEDTESTS == 8
+ invoke_test<simd<T, simd_abi::fixed_size<7>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<15>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<23>>>(int());
+ invoke_test<simd<T, simd_abi::fixed_size<31>>>(int());
+#endif
+ }
+
+int main()
+{
+ iterate_abis<_GLIBCXX_SIMD_TESTTYPE>();
+ return 0;
+}
+
+#endif // TESTS_BITS_MAIN_H_
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#ifndef SIMD_TESTS_BITS_MAKE_VEC_H_
+#define SIMD_TESTS_BITS_MAKE_VEC_H_
#include <experimental/simd>
template <class M>
@@ -36,6 +38,13 @@ template <class M>
}
}
+template <class M>
+ M
+ make_alternating_mask()
+ {
+ return make_mask<M>({false, true});
+ }
+
template <class V>
inline V
make_vec(const std::initializer_list<typename V::value_type> &init,
@@ -57,3 +66,4 @@ template <class V>
base += inc;
}
}
+#endif // SIMD_TESTS_BITS_MAKE_VEC_H_
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#ifndef SIMD_TESTS_BITS_MATHREFERENCE_H_
+#define SIMD_TESTS_BITS_MATHREFERENCE_H_
#include <tuple>
#include <utility>
#include <cstdio>
@@ -158,3 +160,4 @@ template <class Fun, class T, class Ref = testdatatype_for_function_t<Fun, T>>
}
return data;
}
+#endif // SIMD_TESTS_BITS_MATHREFERENCE_H_
@@ -15,6 +15,11 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#ifndef SIMD_TESTS_BITS_TEST_VALUES_H_
+#define SIMD_TESTS_BITS_TEST_VALUES_H_
+
+#include "verify.h"
+
#include <experimental/simd>
#include <initializer_list>
#include <random>
@@ -381,3 +386,4 @@ template <class V>
#endif
#define MAKE_TESTER(name_) MAKE_TESTER_2(name_, std::name_)
+#endif // SIMD_TESTS_BITS_TEST_VALUES_H_
@@ -286,68 +286,4 @@ template <typename V, typename = decltype(V())>
__builtin_fprintf(stderr, "PASS: %s\n", __PRETTY_FUNCTION__);
}
-template <class T>
- void
- iterate_abis()
- {
- using namespace std::experimental::parallelism_v2;
-#ifndef EXTENDEDTESTS
- invoke_test<simd<T, simd_abi::scalar>>(int());
- invoke_test<simd<T, simd_abi::_VecBuiltin<16>>>(int());
- invoke_test<simd<T, simd_abi::_VecBltnBtmsk<64>>>(int());
-#elif EXTENDEDTESTS == 0
- invoke_test<simd<T, simd_abi::_VecBuiltin<8>>>(int());
- invoke_test<simd<T, simd_abi::_VecBuiltin<12>>>(int());
- invoke_test<simd<T, simd_abi::_VecBuiltin<24>>>(int());
- invoke_test<simd<T, simd_abi::_VecBuiltin<32>>>(int());
- invoke_test<simd<T, simd_abi::_VecBltnBtmsk<56>>>(int());
-#elif EXTENDEDTESTS == 1
- invoke_test<simd<T, simd_abi::fixed_size<8>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<16>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<24>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<32>>>(int());
-#elif EXTENDEDTESTS == 2
- invoke_test<simd<T, simd_abi::fixed_size<1>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<9>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<17>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<25>>>(int());
-#elif EXTENDEDTESTS == 3
- invoke_test<simd<T, simd_abi::fixed_size<2>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<10>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<18>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<26>>>(int());
-#elif EXTENDEDTESTS == 4
- invoke_test<simd<T, simd_abi::fixed_size<3>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<19>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<11>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<27>>>(int());
-#elif EXTENDEDTESTS == 5
- invoke_test<simd<T, simd_abi::fixed_size<4>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<12>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<20>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<28>>>(int());
-#elif EXTENDEDTESTS == 6
- invoke_test<simd<T, simd_abi::fixed_size<5>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<13>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<21>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<29>>>(int());
-#elif EXTENDEDTESTS == 7
- invoke_test<simd<T, simd_abi::fixed_size<6>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<14>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<22>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<30>>>(int());
-#elif EXTENDEDTESTS == 8
- invoke_test<simd<T, simd_abi::fixed_size<7>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<15>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<23>>>(int());
- invoke_test<simd<T, simd_abi::fixed_size<31>>>(int());
-#endif
- }
-
-int main()
-{
- iterate_abis<_GLIBCXX_SIMD_TESTTYPE>();
- return 0;
-}
-
#endif // TESTS_BITS_VERIFY_H_
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
enum unscoped_enum
{ foo };
@@ -16,9 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/conversions.h"
+#include "bits/main.h"
using std::experimental::simd_cast;
using std::experimental::static_simd_cast;
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
#include <cfenv>
template <typename F>
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <class V>
struct call_generator
@@ -18,9 +18,7 @@
// only: float|double|ldouble * * *
// skip: ldouble * powerpc64* *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
// 3-arg std::hypot needs to be fixed, this is a better reference:
template <typename T>
@@ -16,9 +16,8 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/make_vec.h"
-#include "bits/metahelpers.h"
+// timeout-factor: 2
+#include "bits/main.h"
template <typename T, T Begin, T End, T Stride = 1, typename F>
void
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -17,9 +17,7 @@
// expensive: * [1-9] * *
// timeout-factor: 2
-#include "bits/verify.h"
-#include "bits/make_vec.h"
-#include "bits/conversions.h"
+#include "bits/main.h"
template <typename V, typename U>
void
@@ -17,10 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/mathreference.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,7 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
+#include "bits/main.h"
namespace stdx = std::experimental;
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <class M, class M2>
constexpr bool assign_should_work
@@ -16,34 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-
-// simd_mask generator functions
-template <class M>
- M
- make_mask(const std::initializer_list<bool>& init)
- {
- std::size_t i = 0;
- M r = {};
- for (;;)
- {
- for (bool x : init)
- {
- r[i] = x;
- if (++i == M::size())
- {
- return r;
- }
- }
- }
- }
-
-template <class M>
- M
- make_alternating_mask()
- {
- return make_mask<M>({false, true});
- }
+#include "bits/main.h"
template <typename V>
void
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
using schar = signed char;
using uchar = unsigned char;
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,35 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-
-// simd_mask generator functions
-template <class M>
- M
- make_mask(const std::initializer_list<bool>& init)
- {
- std::size_t i = 0;
- M r = {};
- for (;;)
- {
- for (bool x : init)
- {
- r[i] = x;
- if (++i == M::size())
- {
- return r;
- }
- }
- }
- }
-
-template <class M>
- M
- make_alternating_mask()
- {
- return make_mask<M>({false, true});
- }
+#include "bits/main.h"
template <typename V>
void
@@ -17,8 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,8 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
// type with sizeof(char) but different signedness
using xchar = std::conditional_t<std::is_unsigned_v<char>, schar, uchar>;
@@ -16,19 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/make_vec.h"
-#include "bits/test_values.h"
-
-template <class T>
- constexpr T
- genHalfBits()
- {
- if constexpr (std::is_floating_point_v<T>)
- return 0;
- else
- return std::__finite_max_v<T> >> (std::__digits_v<T> / 2);
- }
+#include "bits/main.h"
template <typename V>
void
@@ -16,9 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
#include <random>
template <typename V>
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,7 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
+#include "bits/main.h"
template <typename V>
void
@@ -18,11 +18,7 @@
// only: float|double|ldouble * * *
// xfail: run * * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/mathreference.h"
-#include "bits/simd_view.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,9 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/conversions.h"
+#include "bits/main.h"
using std::experimental::simd_cast;
@@ -16,7 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
+#include "bits/main.h"
template <typename V>
void
@@ -17,9 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/metahelpers.h"
-#include "bits/test_values.h"
+#include "bits/main.h"
template <typename V>
void
@@ -17,8 +17,7 @@
// only: float|double|ldouble * * *
// expensive: * [1-9] * *
-#include "bits/test_values.h"
-#include "bits/verify.h"
+#include "bits/main.h"
template <typename V>
void
@@ -16,9 +16,7 @@
// <http://www.gnu.org/licenses/>.
// expensive: * [1-9] * *
-#include "bits/verify.h"
-#include "bits/make_vec.h"
-#include "bits/metahelpers.h"
+#include "bits/main.h"
template <class V>
struct Convertible