[libcxx-commits] [libcxx] [libc++] <experimental/simd> Add operator value_type() of simd reference (PR #68960)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 13 02:38:50 PDT 2023


================
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
+
+// <experimental/simd>
+//
+// [simd.reference]
+// operator value_type() const noexcept;
+
+#include "../test_utils.h"
+#include <experimental/simd>
+
+namespace ex = std::experimental::parallelism_v2;
+
+template <class T, std::size_t>
+struct CheckSimdReferenceValueType {
+  template <class SimdAbi>
+  void operator()() {
+    ex::simd<T, SimdAbi> origin_simd([](T i) { return static_cast<T>(i); });
+    for (size_t i = 0; i < origin_simd.size(); ++i) {
+      static_assert(std::is_same_v<T, decltype(T(origin_simd[i]))>);
----------------
philnik777 wrote:

This seems trivially true, so I'm not sure it buys us anything. I think we can just remove this line and have exactly the same test coverage.

https://github.com/llvm/llvm-project/pull/68960


More information about the libcxx-commits mailing list