Zhangyin 0e30dd44ad [libcxx] <experimental/simd> Add ABI tags, class template simd/simd_mask implementations. Add related simd traits and tests.
[libcxx] <experimental/simd> Add ABI tags, class template simd/simd_mask implementations.
[libcxx] <experimental/simd> Add traits is_abi_tag[_v], is_simd[_v] and is_simd_mask[_v].
[libcxx] <experimental/simd> Add related tests.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D144362
2023-09-12 11:41:40 +08:00

42 lines
1.1 KiB
C++

//===----------------------------------------------------------------------===//
//
// 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.traits]
// template <class T> struct ex::is_simd;
// template <class T> inline constexpr bool ex::is_simd_v =
// ex::is_simd<T>::value;
#include "../test_utils.h"
namespace ex = std::experimental::parallelism_v2;
template <class T, std::size_t>
struct CheckIsSimd {
template <class SimdAbi>
void operator()() {
static_assert(ex::is_simd<ex::simd<T, SimdAbi>>::value);
static_assert(!ex::is_simd<T>::value);
static_assert(!ex::is_simd<ex::simd_mask<T, SimdAbi>>::value);
static_assert(ex::is_simd_v<ex::simd<T, SimdAbi>>);
static_assert(!ex::is_simd_v<T>);
static_assert(!ex::is_simd_v<ex::simd_mask<T, SimdAbi>>);
}
};
int main(int, char**) {
test_all_simd_abi<CheckIsSimd>();
return 0;
}