Skip to content

Commit

Permalink
Work around GCC PR94413
Browse files Browse the repository at this point in the history
With the array-based simd implementation, GCC might auto-vectorize the
classification functions, hitting PR94413 (auto-vectorization of
isfinite raises FP exception).

ChangeLog:

	* testsuite/tests/fpclassify.cc: Only test FP exceptions with
	the libstdc++ implementation.
	* vir/simd.h: Define VIR_HAVE_STD_SIMD or VIR_HAVE_VIR_SIMD.
  • Loading branch information
mattkretz committed Sep 11, 2023
1 parent 4381108 commit b04d4bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions testsuite/tests/fpclassify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ template <typename F>
return r;
}

#if VIR_HAVE_STD_SIMD
#define NOFPEXCEPT(...) verify_no_fp_exceptions([&]() { return __VA_ARGS__; })
#elif VIR_HAVE_VIR_SIMD
// With the array-based simd implementation, GCC might auto-vectorize the classification functions,
// hitting PR94413 (auto-vectorization of isfinite raises FP exception). Therefore, simply ignore FP
// exceptions then.
#define NOFPEXCEPT(...) [&]() { return __VA_ARGS__; }()
#endif

template <typename V>
void
Expand Down
4 changes: 4 additions & 0 deletions vir/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#if defined __cpp_lib_experimental_parallel_simd && __cpp_lib_experimental_parallel_simd >= 201803

#define VIR_HAVE_STD_SIMD 1

namespace vir::stdx
{
using namespace std::experimental::parallelism_v2;
Expand All @@ -43,6 +45,8 @@ namespace vir::stdx
#include <type_traits>
#include <utility>

#define VIR_HAVE_VIR_SIMD 1

#ifdef VIR_SIMD_TS_DROPIN
namespace std::experimental
{
Expand Down

0 comments on commit b04d4bf

Please sign in to comment.