[1/2] libstdc++: Fix simd test compilation with Clang

Message ID 12217370.T7Z3S40VBb@minbar
State Accepted
Headers
Series Make std::experimental::simd (more) usable with Clang |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Matthias Kretz March 21, 2023, 9:23 a.m. UTC
  Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* testsuite/experimental/simd/tests/operators.cc: Clang doesn't
	define __GCC_IEC_559. Use __STDC_IEC_559__ instead.
---
 .../testsuite/experimental/simd/tests/operators.cc       | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


--
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 stdₓ::simd
──────────────────────────────────────────────────────────────────────────
  

Comments

Jonathan Wakely March 21, 2023, 11:16 a.m. UTC | #1
On Tue, 21 Mar 2023 at 09:24, Matthias Kretz via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

>
>
> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
>         * testsuite/experimental/simd/tests/operators.cc: Clang doesn't
>         define __GCC_IEC_559. Use __STDC_IEC_559__ instead.
>


OK, thanks.
  

Patch

diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/operators.cc b/libstdc++-v3/testsuite/experimental/simd/tests/operators.cc
index c4d91fa5d2b..72af7061c73 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/operators.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/operators.cc
@@ -211,7 +211,14 @@  test()
     }
 
     // divides
-    constexpr bool is_iec559 = __GCC_IEC_559 >= 2;
+    constexpr bool is_iec559 =
+#ifdef __GCC_IEC_559
+      __GCC_IEC_559 >= 2;
+#elif defined __STDC_IEC_559__
+      true;
+#else
+      false;
+#endif
     if constexpr (std::is_floating_point_v<T> && !is_iec559)
       { // avoid testing subnormals and expect minor deltas for non-IEC559 float
 	V x = 2;