diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 746d5812fba0..0fe3ab44d246 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -914,10 +914,8 @@ set(files expected experimental/__config experimental/__memory - experimental/__simd/abi_tag.h experimental/__simd/aligned_tag.h experimental/__simd/declaration.h - experimental/__simd/internal_declaration.h experimental/__simd/reference.h experimental/__simd/scalar.h experimental/__simd/simd.h diff --git a/libcxx/include/experimental/__simd/abi_tag.h b/libcxx/include/experimental/__simd/abi_tag.h deleted file mode 100644 index cec5be65ce5c..000000000000 --- a/libcxx/include/experimental/__simd/abi_tag.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- 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 -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H -#define _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H - -#include -#include -#include - -#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -inline namespace parallelism_v2 { -namespace simd_abi { - -using scalar = __scalar; - -// TODO: make this platform dependent -template -using fixed_size = __vec_ext<_Np>; - -template -inline constexpr int max_fixed_size = 32; - -// TODO: make this platform dependent -template -using compatible = __vec_ext<16 / sizeof(_Tp)>; - -// TODO: make this platform dependent -template -using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>; - -// TODO: make this platform dependent -template -struct deduce { - using type = fixed_size<_Np>; -}; - -// TODO: make this platform dependent -template -using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type; - -} // namespace simd_abi -} // namespace parallelism_v2 -_LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) -#endif // _LIBCPP_EXPERIMENTAL___SIMD_ABI_TAG_H diff --git a/libcxx/include/experimental/__simd/aligned_tag.h b/libcxx/include/experimental/__simd/aligned_tag.h index d216a21c073f..edbb3b24931f 100644 --- a/libcxx/include/experimental/__simd/aligned_tag.h +++ b/libcxx/include/experimental/__simd/aligned_tag.h @@ -10,10 +10,10 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H #define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H -#include <__bit/bit_ceil.h> #include <__memory/assume_aligned.h> #include #include +#include #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) @@ -30,9 +30,12 @@ struct element_aligned_tag { } }; +template <> +inline constexpr bool is_simd_flag_type_v = true; + struct vector_aligned_tag { template - static constexpr size_t __alignment = std::__bit_ceil(sizeof(_Up) * _Tp::size()); + static constexpr size_t __alignment = memory_alignment_v<_Tp, _Up>; template static _LIBCPP_HIDE_FROM_ABI constexpr _Up* __apply(_Up* __ptr) { @@ -40,6 +43,9 @@ struct vector_aligned_tag { } }; +template <> +inline constexpr bool is_simd_flag_type_v = true; + template struct overaligned_tag { template @@ -51,6 +57,9 @@ struct overaligned_tag { } }; +template +inline constexpr bool is_simd_flag_type_v> = true; + inline constexpr element_aligned_tag element_aligned{}; inline constexpr vector_aligned_tag vector_aligned{}; diff --git a/libcxx/include/experimental/__simd/declaration.h b/libcxx/include/experimental/__simd/declaration.h index 065faeaec384..7b45d035c271 100644 --- a/libcxx/include/experimental/__simd/declaration.h +++ b/libcxx/include/experimental/__simd/declaration.h @@ -10,13 +10,63 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H #define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H +#include #include -#include #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 { +namespace simd_abi { +template +struct __vec_ext; +struct __scalar; + +using scalar = __scalar; + +// TODO: make this platform dependent +template +using fixed_size = __vec_ext<_Np>; + +template +inline constexpr int max_fixed_size = 32; + +// TODO: make this platform dependent +template +using compatible = __vec_ext<16 / sizeof(_Tp)>; + +// TODO: make this platform dependent +template +using native = __vec_ext<_LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES / sizeof(_Tp)>; + +// TODO: make this platform dependent +template +struct deduce { + using type = fixed_size<_Np>; +}; + +// TODO: make this platform dependent +template +using deduce_t = typename deduce<_Tp, _Np, _Abis...>::type; + +} // namespace simd_abi + +template +struct __simd_storage; + +template +struct __mask_storage; + +template +struct __simd_operations; + +template +struct __mask_operations; + +struct element_aligned_tag; +struct vector_aligned_tag; +template +struct overaligned_tag; template > class simd; diff --git a/libcxx/include/experimental/__simd/internal_declaration.h b/libcxx/include/experimental/__simd/internal_declaration.h deleted file mode 100644 index 9ad1ad1ae319..000000000000 --- a/libcxx/include/experimental/__simd/internal_declaration.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- 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 -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H -#define _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H - -#include - -#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -inline namespace parallelism_v2 { -namespace simd_abi { -template -struct __vec_ext; -struct __scalar; -} // namespace simd_abi - -template -struct __simd_storage; - -template -struct __mask_storage; - -template -struct __simd_operations; - -template -struct __mask_operations; - -} // namespace parallelism_v2 -_LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) -#endif // _LIBCPP_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H diff --git a/libcxx/include/experimental/__simd/scalar.h b/libcxx/include/experimental/__simd/scalar.h index 53fa1c29f374..5eeff4c1e82a 100644 --- a/libcxx/include/experimental/__simd/scalar.h +++ b/libcxx/include/experimental/__simd/scalar.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) diff --git a/libcxx/include/experimental/__simd/simd.h b/libcxx/include/experimental/__simd/simd.h index ffb328eb345b..c345811fee7f 100644 --- a/libcxx/include/experimental/__simd/simd.h +++ b/libcxx/include/experimental/__simd/simd.h @@ -15,9 +15,7 @@ #include <__utility/forward.h> #include #include -#include #include -#include #include #include #include diff --git a/libcxx/include/experimental/__simd/simd_mask.h b/libcxx/include/experimental/__simd/simd_mask.h index 325b8409e3b6..db03843b46e3 100644 --- a/libcxx/include/experimental/__simd/simd_mask.h +++ b/libcxx/include/experimental/__simd/simd_mask.h @@ -13,9 +13,7 @@ #include <__type_traits/is_same.h> #include #include -#include #include -#include #include #include diff --git a/libcxx/include/experimental/__simd/traits.h b/libcxx/include/experimental/__simd/traits.h index 9b4abe9d0c23..ec25b4bfa7f9 100644 --- a/libcxx/include/experimental/__simd/traits.h +++ b/libcxx/include/experimental/__simd/traits.h @@ -10,14 +10,12 @@ #ifndef _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H #define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H +#include <__bit/bit_ceil.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_same.h> #include #include -#include -#include #include -#include #include #if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) @@ -47,15 +45,6 @@ struct is_simd_mask : bool_constant> {}; template inline constexpr bool is_simd_flag_type_v = false; -template <> -inline constexpr bool is_simd_flag_type_v = true; - -template <> -inline constexpr bool is_simd_flag_type_v = true; - -template -inline constexpr bool is_simd_flag_type_v> = true; - template struct is_simd_flag_type : bool_constant> {}; @@ -71,7 +60,7 @@ inline constexpr size_t simd_size_v = simd_size<_Tp, _Abi>::value; template && __is_vectorizable_v<_Up>) || (is_simd_mask_v<_Tp> && is_same_v<_Up, bool>)> -struct memory_alignment : integral_constant> {}; +struct memory_alignment : integral_constant {}; template struct memory_alignment<_Tp, _Up, false> {}; diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h index 56a0b888104b..07ba032f493b 100644 --- a/libcxx/include/experimental/__simd/vec_ext.h +++ b/libcxx/include/experimental/__simd/vec_ext.h @@ -15,7 +15,7 @@ #include <__utility/integer_sequence.h> #include #include -#include +#include #include #include diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd index 56858832857c..adca9faa47bb 100644 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -78,7 +78,6 @@ inline namespace parallelism_v2 { #endif #include -#include #include #include #include diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in index a37e96205cf2..d10670d4faaf 100644 --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -530,10 +530,8 @@ module std_experimental [system] { export * } module simd { - module abi_tag { private header "experimental/__simd/abi_tag.h" } module aligned_tag { private header "experimental/__simd/aligned_tag.h" } module declaration { private header "experimental/__simd/declaration.h" } - module internal_declaration { private header "experimental/__simd/internal_declaration.h" } module reference { private header "experimental/__simd/reference.h" } module scalar { private header "experimental/__simd/scalar.h" } module simd { private header "experimental/__simd/simd.h" }