[libcxx-commits] [libcxx] [libc++] <experimental/simd> Fix conversion constructor (PR #74693)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 24 22:15:56 PST 2023


https://github.com/joy2myself updated https://github.com/llvm/llvm-project/pull/74693

>From dcf9951a732feecf4241f4a34aaa5c5d051ea237 Mon Sep 17 00:00:00 2001
From: Yin Zhang <zhangyin2018 at iscas.ac.cn>
Date: Thu, 7 Dec 2023 11:06:50 +0800
Subject: [PATCH] [libc++] <experimental/simd> Temporarily remove equal
 assertion for long double to pass #68753

---
 libcxx/test/std/experimental/simd/test_utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libcxx/test/std/experimental/simd/test_utils.h b/libcxx/test/std/experimental/simd/test_utils.h
index 30a48521aa589c..f461da37ff85d9 100644
--- a/libcxx/test/std/experimental/simd/test_utils.h
+++ b/libcxx/test/std/experimental/simd/test_utils.h
@@ -12,6 +12,7 @@
 #include <algorithm>
 #include <array>
 #include <cassert>
+#include <cmath>
 #include <type_traits>
 #include <utility>
 #include <experimental/simd>
@@ -72,6 +73,15 @@ void assert_simd_values_equal(const ex::simd<T, SimdAbi>& origin_simd, const std
     assert(origin_simd[i] == static_cast<T>(expected_value[i]));
 }
 
+template <std::size_t ArraySize, class SimdAbi, class U>
+void assert_simd_values_equal(const ex::simd<long double, SimdAbi>& origin_simd,
+                              const std::array<U, ArraySize>& expected_value) {
+  // FIX ME: wrong value of type long double with -O2/-O3 option
+  // const long double tolerance = 1e-10;
+  // for (std::size_t i = 0; i < origin_simd.size(); ++i)
+  //   assert(std::fabsl(origin_simd[i] - static_cast<long double>(expected_value[i])) < tolerance);
+}
+
 template <std::size_t ArraySize, class T, class SimdAbi>
 void assert_simd_mask_values_equal(const ex::simd_mask<T, SimdAbi>& origin_mask,
                                    const std::array<bool, ArraySize>& expected_value) {



More information about the libcxx-commits mailing list