[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / experimental / __simd / traits.h
blob3a0480b512e2e11519548fe6197be0884ee1f093
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
11 #define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
13 #include <__cxx03/__bit/bit_ceil.h>
14 #include <__cxx03/__type_traits/integral_constant.h>
15 #include <__cxx03/__type_traits/is_same.h>
16 #include <__cxx03/cstddef>
17 #include <__cxx03/experimental/__config>
18 #include <__cxx03/experimental/__simd/declaration.h>
19 #include <__cxx03/experimental/__simd/utility.h>
21 #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
23 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
24 inline namespace parallelism_v2 {
26 // traits [simd.traits]
27 template <class _Tp>
28 inline constexpr bool is_abi_tag_v = false;
30 template <class _Tp>
31 struct is_abi_tag : bool_constant<is_abi_tag_v<_Tp>> {};
33 template <class _Tp>
34 inline constexpr bool is_simd_v = false;
36 template <class _Tp>
37 struct is_simd : bool_constant<is_simd_v<_Tp>> {};
39 template <class _Tp>
40 inline constexpr bool is_simd_mask_v = false;
42 template <class _Tp>
43 struct is_simd_mask : bool_constant<is_simd_mask_v<_Tp>> {};
45 template <class _Tp>
46 inline constexpr bool is_simd_flag_type_v = false;
48 template <class _Tp>
49 struct is_simd_flag_type : bool_constant<is_simd_flag_type_v<_Tp>> {};
51 template <class _Tp, class _Abi = simd_abi::compatible<_Tp>, bool = (__is_vectorizable_v<_Tp> && is_abi_tag_v<_Abi>)>
52 struct simd_size : integral_constant<size_t, _Abi::__simd_size> {};
54 template <class _Tp, class _Abi>
55 struct simd_size<_Tp, _Abi, false> {};
57 template <class _Tp, class _Abi = simd_abi::compatible<_Tp>>
58 inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value;
60 template <class _Tp,
61 class _Up = typename _Tp::value_type,
62 bool = (is_simd_v<_Tp> && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)>
63 struct memory_alignment : integral_constant<size_t, std::__bit_ceil(sizeof(_Up) * _Tp::size())> {};
65 template <class _Tp, class _Up>
66 struct memory_alignment<_Tp, _Up, false> {};
68 template <class _Tp, class _Up = typename _Tp::value_type>
69 inline constexpr size_t memory_alignment_v = memory_alignment<_Tp, _Up>::value;
71 } // namespace parallelism_v2
72 _LIBCPP_END_NAMESPACE_EXPERIMENTAL
74 #endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
75 #endif // _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H