commit 6f6978491695de9049e11b4f629c8a2d1a5f2075
parent 85000e10217241e44402e582ffe366e1a8932389
Author: [email protected] <[email protected]>
Date: Tue, 11 Oct 2016 04:07:16 +0300
Move simd and related functions to kfr::internal
Diffstat:
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/kfr/base/read_write.hpp b/include/kfr/base/read_write.hpp
@@ -35,13 +35,13 @@ namespace kfr
template <size_t N, bool A = false, typename T>
CMT_INLINE vec<T, N> read(const T* src)
{
- return simd_read<N * compound_type_traits<T>::width, A>(ptr_cast<subtype<T>>(src));
+ return internal::simd_read<N * compound_type_traits<T>::width, A>(ptr_cast<subtype<T>>(src));
}
template <bool A = false, size_t N, typename T>
CMT_INLINE void write(T* dest, const vec<T, N>& value)
{
- simd_write<A, N * compound_type_traits<T>::width>(ptr_cast<subtype<T>>(dest), *value);
+ internal::simd_write<A, N * compound_type_traits<T>::width>(ptr_cast<subtype<T>>(dest), *value);
}
template <typename... Indices, typename T, size_t Nout = 1 + sizeof...(Indices)>
diff --git a/include/kfr/base/simd.hpp b/include/kfr/base/simd.hpp
@@ -33,6 +33,8 @@ CMT_PRAGMA_MSVC(warning(disable : 4324))
namespace kfr
{
+namespace internal
+{
constexpr size_t index_undefined = static_cast<size_t>(-1);
@@ -108,9 +110,6 @@ CMT_INLINE void simd_write(T* dest, const simd<T, N>& value)
#else
-namespace internal
-{
-
template <typename T>
constexpr inline T maskbits(bool value);
@@ -149,7 +148,6 @@ struct simd_int_ops : simd_float_ops<T>
constexpr static T shl(T x, T y) { return x << y; }
constexpr static T shr(T x, T y) { return x >> y; }
};
-}
template <typename T, size_t N>
struct alignas(const_min(size_t(64), next_poweroftwo(N * sizeof(T)))) simd
@@ -315,12 +313,13 @@ CMT_INLINE void simd_write(T* dest, const simd<T, N>& value)
}
#define KFR_SIMD_SET(T, ...) (T{ { __VA_ARGS__ } })
-#define KFR_SIMD_CAST(T, N, X) ((void)N, ::kfr::simd_cast<T>(X))
-#define KFR_SIMD_BITCAST(T, N, X) ((void)N, ::kfr::simd_bitcast<T>(X))
-#define KFR_SIMD_BROADCAST(T, N, X) (::kfr::simd<T, N>::broadcast(X))
-#define KFR_SIMD_SHUFFLE(X, Y, ...) simd_shuffle(X, Y, cints_t<__VA_ARGS__>())
+#define KFR_SIMD_CAST(T, N, X) ((void)N, ::kfr::internal::simd_cast<T>(X))
+#define KFR_SIMD_BITCAST(T, N, X) ((void)N, ::kfr::internal::simd_bitcast<T>(X))
+#define KFR_SIMD_BROADCAST(T, N, X) (::kfr::internal::simd<T, N>::broadcast(X))
+#define KFR_SIMD_SHUFFLE(X, Y, ...) (::kfr::internal::simd_shuffle(X, Y, cints_t<__VA_ARGS__>()))
#endif
}
+}
CMT_PRAGMA_MSVC(warning(pop))
diff --git a/include/kfr/base/vec.hpp b/include/kfr/base/vec.hpp
@@ -40,6 +40,8 @@ CMT_PRAGMA_GNU(GCC diagnostic ignored "-Wpacked")
namespace kfr
{
+using internal::simd;
+
template <typename T, size_t N>
struct vec_op
{
@@ -535,7 +537,10 @@ template <typename T, size_t N>
struct pkd_vec
{
constexpr pkd_vec() noexcept {}
- pkd_vec(const vec<T, N>& value) noexcept { simd_write<false, vec<T, N>::scalar_size()>(v, *value); }
+ pkd_vec(const vec<T, N>& value) noexcept
+ {
+ internal::simd_write<false, vec<T, N>::scalar_size()>(v, *value);
+ }
template <typename... Ts>
constexpr pkd_vec(Ts... init) noexcept : v{ static_cast<T>(init)... }
{