Warning: This file is not a C or C++ file. It does not have highlighting.
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 | //===----------------------------------------------------------------------===// |
9 | |
10 | #ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H |
11 | #define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H |
12 | |
13 | #include <__config> |
14 | #include <__cstddef/size_t.h> |
15 | |
16 | #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) |
17 | |
18 | // TODO: support more targets |
19 | # if defined(__AVX__) |
20 | # define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32 |
21 | # else |
22 | # define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16 |
23 | # endif |
24 | |
25 | _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL |
26 | inline namespace parallelism_v2 { |
27 | namespace simd_abi { |
28 | template <int> |
29 | struct __vec_ext; |
30 | struct __scalar; |
31 | |
32 | using scalar = __scalar; |
33 | |
34 | // TODO: make this platform dependent |
35 | template <int _Np> |
36 | using fixed_size = __vec_ext<_Np>; |
37 | |
38 | template <class _Tp> |
39 | inline constexpr int max_fixed_size = 32; |
40 | |
41 | // TODO: make this platform dependent |
42 | template <class _Tp> |
43 | using compatible = __vec_ext<16 / sizeof(_Tp)>; |
44 | |
45 | // TODO: make this platform dependent |
46 | template <class _Tp> |
47 | using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>; |
48 | |
49 | // TODO: make this platform dependent |
50 | template <class _Tp, size_t _Np, class... _Abis> |
51 | struct deduce { |
52 | using type _LIBCPP_NODEBUG = fixed_size<_Np>; |
53 | }; |
54 | |
55 | // TODO: make this platform dependent |
56 | template <class _Tp, size_t _Np, class... _Abis> |
57 | using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type; |
58 | |
59 | } // namespace simd_abi |
60 | |
61 | template <class _Tp, class _Abi> |
62 | struct __simd_storage; |
63 | |
64 | template <class _Tp, class _Abi> |
65 | struct __mask_storage; |
66 | |
67 | template <class _Tp, class _Abi> |
68 | struct __simd_operations; |
69 | |
70 | template <class _Tp, class _Abi> |
71 | struct __mask_operations; |
72 | |
73 | struct element_aligned_tag; |
74 | struct vector_aligned_tag; |
75 | template <size_t> |
76 | struct overaligned_tag; |
77 | |
78 | template <class _Tp, class _Abi = simd_abi::compatible<_Tp>> |
79 | class simd; |
80 | |
81 | template <class _Tp, class _Abi = simd_abi::compatible<_Tp>> |
82 | class simd_mask; |
83 | |
84 | } // namespace parallelism_v2 |
85 | _LIBCPP_END_NAMESPACE_EXPERIMENTAL |
86 | |
87 | #endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) |
88 | #endif // _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H |
89 |
Warning: This file is not a C or C++ file. It does not have highlighting.