xref: /llvm-project/libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_broadcast.pass.cpp (revision cf31d0eca85f4f5b273dd1ad8f76791ff726c28f)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14
10 
11 // <experimental/simd>
12 //
13 // [simd.mask.class]
14 // explicit simd_mask(value_type) noexcept;
15 
16 #include "../test_utils.h"
17 #include <experimental/simd>
18 
19 namespace ex = std::experimental::parallelism_v2;
20 
21 template <class T, std::size_t>
22 struct CheckMaskBroadcastCtor {
23   template <class SimdAbi>
operator ()CheckMaskBroadcastCtor24   void operator()() {
25     constexpr size_t array_size = ex::simd_size_v<T, SimdAbi>;
26     const ex::simd_mask<T, SimdAbi> mask_ctor_from_broadcast(false);
27     const std::array<bool, array_size> expected_value{};
28     assert_simd_mask_values_equal(mask_ctor_from_broadcast, expected_value);
29   }
30 };
31 
main(int,char **)32 int main(int, char**) {
33   test_all_simd_abi<CheckMaskBroadcastCtor>();
34   return 0;
35 }
36