Skip to content

Commit

Permalink
Use simd_vector instead of simd_type
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleš Hrabalík committed Nov 4, 2016
1 parent b82db35 commit d8840aa
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion bench/ray_box.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SIMDEE_NEED_INT 0
#include <simdee/simd_types/avx.hpp>
#include <simdee/simd_vectors/avx.hpp>
#include <simdee/util/allocator.hpp>

#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/avx.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `sd::avx_` (type family)

Defined in header `<simdee/simd_types/avx.hpp>`
Defined in header `<simdee/simd_vectors/avx.hpp>`

`sd::avx_` is an architecture-specific type family that employs the AVX instruction set and its extensions. If you use `sd::avx_` type family in your code, AVX support must be enabled. Unless the macro `SIMDEE_NEED_INT` is set to `0`, AVX2 support must be enabled. See guide on how to [enable instruction sets](../guides/config.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/dual.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `sd::dual<T>`

Defined in header `<simdee/simd_types/dual.hpp>`
Defined in header `<simdee/simd_vectors/dual.hpp>`

`sd::dual` is a class template that creates a new vector based on an existing type `T` that satisfies [`SIMDVector`](SIMDVector.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/dum.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `sd::dum_` (type family)

Defined in header `<simdee/simd_types/dum.hpp>`
Defined in header `<simdee/simd_vectors/dum.hpp>`

`sd::dum_` is a type family of vectors containing only a single scalar.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sse.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `sd::sse_` (type family)

Defined in header `<simdee/simd_types/sse.hpp>`
Defined in header `<simdee/simd_vectors/sse.hpp>`

`sd::sse_` is an architecture-specific type family that employs the SSE2 instruction set and its extensions. If you use `sd::sse_` type family in your code, SSE2 support must be enabled. See guide on how to [enable instruction sets](../guides/config.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace sd {
using not_avxu = expr::deferred_bitnot<avxu>;

template <>
struct is_simd_type<avxb> : std::integral_constant<bool, true> {};
struct is_simd_vector<avxb> : std::integral_constant<bool, true> {};
template <>
struct is_simd_type<avxf> : std::integral_constant<bool, true> {};
struct is_simd_vector<avxf> : std::integral_constant<bool, true> {};
template <>
struct is_simd_type<avxu> : std::integral_constant<bool, true> {};
struct is_simd_vector<avxu> : std::integral_constant<bool, true> {};
template <>
struct is_simd_type<avxs> : std::integral_constant<bool, true> {};
struct is_simd_vector<avxs> : std::integral_constant<bool, true> {};

template <typename Simd_t, typename Vector_t, typename Scalar_t>
struct avx_traits {
Expand All @@ -46,13 +46,13 @@ namespace sd {
};

template <>
struct simd_type_traits<avxb> : avx_traits<avxb, __m256, bool32_t> {};
struct simd_vector_traits<avxb> : avx_traits<avxb, __m256, bool32_t> {};
template <>
struct simd_type_traits<avxf> : avx_traits<avxf, __m256, float> {};
struct simd_vector_traits<avxf> : avx_traits<avxf, __m256, float> {};
template <>
struct simd_type_traits<avxu> : avx_traits<avxu, __m256, uint32_t> {};
struct simd_vector_traits<avxu> : avx_traits<avxu, __m256, uint32_t> {};
template <>
struct simd_type_traits<avxs> : avx_traits<avxs, __m256, int32_t> {};
struct simd_vector_traits<avxs> : avx_traits<avxs, __m256, int32_t> {};

template <typename Crtp>
struct avx_base : simd_base<Crtp> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
namespace sd {

template <typename T>
struct is_simd_type : std::integral_constant<bool, false> {};
struct is_simd_vector : std::integral_constant<bool, false> {};
template <typename T>
struct simd_type_traits;
struct simd_vector_traits;

template <typename Crtp>
struct simd_base {
using traits_t = simd_type_traits<Crtp>;
using traits_t = simd_vector_traits<Crtp>;
using vector_t = typename traits_t::vector_t;
using scalar_t = typename traits_t::scalar_t;
using vec_b = typename traits_t::vec_b;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ namespace sd {
struct dual;

template <typename T>
struct is_simd_type<dual<T>> : std::integral_constant<bool, true> {};
struct is_simd_vector<dual<T>> : std::integral_constant<bool, true> {};

template <typename T>
struct simd_type_traits<dual<T>> {
struct simd_vector_traits<dual<T>> {
using simd_t = dual<T>;
using vector_t = impl::pair<T>;
using scalar_t = typename simd_type_traits<T>::scalar_t;
using vec_b = dual<typename simd_type_traits<T>::vec_b>;
using vec_f = dual<typename simd_type_traits<T>::vec_f>;
using vec_u = dual<typename simd_type_traits<T>::vec_u>;
using vec_s = dual<typename simd_type_traits<T>::vec_s>;
using mask_t = impl::dual_mask_t<typename simd_type_traits<T>::mask_t>;
using scalar_t = typename simd_vector_traits<T>::scalar_t;
using vec_b = dual<typename simd_vector_traits<T>::vec_b>;
using vec_f = dual<typename simd_vector_traits<T>::vec_f>;
using vec_u = dual<typename simd_vector_traits<T>::vec_u>;
using vec_s = dual<typename simd_vector_traits<T>::vec_s>;
using mask_t = impl::dual_mask_t<typename simd_vector_traits<T>::mask_t>;
using storage_t = impl::storage<simd_t, scalar_t, alignof(vector_t)>;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace sd {
struct dums;

template<>
struct is_simd_type<dumb> : std::integral_constant<bool, true> {};
struct is_simd_vector<dumb> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<dumf> : std::integral_constant<bool, true> {};
struct is_simd_vector<dumf> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<dumu> : std::integral_constant<bool, true> {};
struct is_simd_vector<dumu> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<dums> : std::integral_constant<bool, true> {};
struct is_simd_vector<dums> : std::integral_constant<bool, true> {};

template <typename Simd_t, typename Vector_t>
struct dum_traits {
Expand All @@ -37,13 +37,13 @@ namespace sd {
};

template <>
struct simd_type_traits<dumb> : dum_traits<dumb, bool32_t> {};
struct simd_vector_traits<dumb> : dum_traits<dumb, bool32_t> {};
template <>
struct simd_type_traits<dumf> : dum_traits<dumf, float> {};
struct simd_vector_traits<dumf> : dum_traits<dumf, float> {};
template <>
struct simd_type_traits<dumu> : dum_traits<dumu, uint32_t> {};
struct simd_vector_traits<dumu> : dum_traits<dumu, uint32_t> {};
template <>
struct simd_type_traits<dums> : dum_traits<dums, int32_t> {};
struct simd_vector_traits<dums> : dum_traits<dums, int32_t> {};

template <typename Crtp>
struct dum_base : simd_base<Crtp> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ namespace sd {
using not_sseu = expr::deferred_bitnot<sseu>;

template<>
struct is_simd_type<sseb> : std::integral_constant<bool, true> {};
struct is_simd_vector<sseb> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<ssef> : std::integral_constant<bool, true> {};
struct is_simd_vector<ssef> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<sseu> : std::integral_constant<bool, true> {};
struct is_simd_vector<sseu> : std::integral_constant<bool, true> {};
template<>
struct is_simd_type<sses> : std::integral_constant<bool, true> {};
struct is_simd_vector<sses> : std::integral_constant<bool, true> {};

template <typename Simd_t, typename Vector_t, typename Scalar_t>
struct sse_traits {
Expand All @@ -43,13 +43,13 @@ namespace sd {
};

template <>
struct simd_type_traits<sseb> : sse_traits<sseb, __m128, bool32_t> {};
struct simd_vector_traits<sseb> : sse_traits<sseb, __m128, bool32_t> {};
template <>
struct simd_type_traits<ssef> : sse_traits<ssef, __m128, float> {};
struct simd_vector_traits<ssef> : sse_traits<ssef, __m128, float> {};
template <>
struct simd_type_traits<sseu> : sse_traits<sseu, __m128, uint32_t> {};
struct simd_vector_traits<sseu> : sse_traits<sseu, __m128, uint32_t> {};
template <>
struct simd_type_traits<sses> : sse_traits<sses, __m128, int32_t> {};
struct simd_vector_traits<sses> : sse_traits<sses, __m128, int32_t> {};

template <typename Crtp>
struct sse_base : simd_base<Crtp> {
Expand Down
6 changes: 3 additions & 3 deletions include/simdee/vec4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// SSE-accelerated vec4 implementation
//
#if SIMDEE_SSE2
#include "simd_types/sse.hpp"
#include "simd_vectors/sse.hpp"

namespace sd {
using vec4b = sseb;
Expand All @@ -23,8 +23,8 @@ namespace sd {
// Emulated vec4 implementation
//
#else
#include "simd_types/dum.hpp"
#include "simd_types/dual.hpp"
#include "simd_vectors/dum.hpp"
#include "simd_vectors/dual.hpp"

namespace sd {
using vec4b = dual<dual<dumb>>;
Expand Down
4 changes: 2 additions & 2 deletions include/simdee/vec8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// AVX-accelerated vec8 implementation
//
#if (!SIMDEE_NEED_INT && SIMDEE_AVX) || SIMDEE_AVX2
#include "simd_types/avx.hpp"
#include "simd_vectors/avx.hpp"

namespace sd {
using vec8b = avxb;
Expand All @@ -24,7 +24,7 @@ namespace sd {
//
#else
#include "vec4.hpp"
#include "simd_types/dual.hpp"
#include "simd_vectors/dual.hpp"

namespace sd {
using vec8b = dual<vec4b>;
Expand Down
8 changes: 4 additions & 4 deletions test/simd_type.inl → test/simd_vector.inl
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ ASSERT((std::is_trivially_copyable<B>::value));
ASSERT((std::is_trivially_copyable<F>::value));
ASSERT((std::is_trivially_copyable<U>::value));
ASSERT((std::is_trivially_copyable<S>::value));
ASSERT((sd::is_simd_type<B>::value));
ASSERT((sd::is_simd_type<F>::value));
ASSERT((sd::is_simd_type<U>::value));
ASSERT((sd::is_simd_type<S>::value));
ASSERT((sd::is_simd_vector<B>::value));
ASSERT((sd::is_simd_vector<F>::value));
ASSERT((sd::is_simd_vector<U>::value));
ASSERT((sd::is_simd_vector<S>::value));
ASSERT(HAS_METHOD(const B, eval(), B));
ASSERT(HAS_METHOD(const F, eval(), F));
ASSERT(HAS_METHOD(const U, eval(), U));
Expand Down
6 changes: 3 additions & 3 deletions test/simd_type_dual.cpp → test/simd_vector_dual.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "catch.hpp"
#include <simdee/simdee.hpp>
#include <simdee/simd_types/dual.hpp>
#include <simdee/simd_vectors/dual.hpp>

using B = sd::dual<sd::vec4b>;
using F = sd::dual<sd::vec4f>;
Expand Down Expand Up @@ -48,7 +48,7 @@ const U::storage_t bufZU{ 0, 0, 0, 0, 0, 0, 0, 0 };
const S::storage_t bufZS{ 0, 0, 0, 0, 0, 0, 0, 0 };

#define SIMD_TYPE "Dual"
#define SIMD_TEST_TAG "[simd_types][dual]"
#define SIMD_TEST_TAG "[simd_vectors][dual]"
#define SIMD_WIDTH 8

#include "simd_type.inl"
#include "simd_vector.inl"
6 changes: 3 additions & 3 deletions test/simd_type_dum.cpp → test/simd_vector_dum.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "catch.hpp"
#include <simdee/simdee.hpp>
#include <simdee/simd_types/dum.hpp>
#include <simdee/simd_vectors/dum.hpp>

using B = sd::dumb;
using F = sd::dumf;
Expand Down Expand Up @@ -39,7 +39,7 @@ const U::storage_t bufZU { 0 };
const S::storage_t bufZS { 0 };

#define SIMD_TYPE "DUM"
#define SIMD_TEST_TAG "[simd_types][dum]"
#define SIMD_TEST_TAG "[simd_vectors][dum]"
#define SIMD_WIDTH 1

#include "simd_type.inl"
#include "simd_vector.inl"
4 changes: 2 additions & 2 deletions test/simd_type_vec4.cpp → test/simd_vector_vec4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const U::storage_t bufZU { 0, 0, 0, 0 };
const S::storage_t bufZS { 0, 0, 0, 0 };

#define SIMD_TYPE "vec4"
#define SIMD_TEST_TAG "[simd_types][vec4]"
#define SIMD_TEST_TAG "[simd_vectors][vec4]"
#define SIMD_WIDTH 4

#include "simd_type.inl"
#include "simd_vector.inl"
4 changes: 2 additions & 2 deletions test/simd_type_vec8.cpp → test/simd_vector_vec8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const U::storage_t bufZU { 0, 0, 0, 0, 0, 0, 0, 0 };
const S::storage_t bufZS { 0, 0, 0, 0, 0, 0, 0, 0 };

#define SIMD_TYPE "vec8"
#define SIMD_TEST_TAG "[simd_types][vec8]"
#define SIMD_TEST_TAG "[simd_vectors][vec8]"
#define SIMD_WIDTH 8

#include "simd_type.inl"
#include "simd_vector.inl"

0 comments on commit d8840aa

Please sign in to comment.