From ddd7ea91cf432e38b681c133d9012f8735511c26 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:20 +0200 Subject: [PATCH 01/10] cmake: Install doc files --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d25b9ec5..b12b124c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,12 @@ install(FILES DESTINATION "${SIMDPP_PKGCONFIGDIR}" ) +install(FILES + "${CMAKE_CURRENT_SOURCE_DIR}/README.md" + "${CMAKE_CURRENT_SOURCE_DIR}/CONTRIBUTING.md" + "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE_1_0.txt" + DESTINATION "${SIMDPP_DOCDIR}" +) enable_testing() From afb4aa4bce126eb207922592b773f9ff0a65df3e Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:21 +0200 Subject: [PATCH 02/10] cmake: Install *.inl headers --- simdpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simdpp/CMakeLists.txt b/simdpp/CMakeLists.txt index 19d6011b..758ec7c1 100644 --- a/simdpp/CMakeLists.txt +++ b/simdpp/CMakeLists.txt @@ -4,7 +4,7 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -file(GLOB_RECURSE HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.inl) +file(GLOB_RECURSE HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.inl *.hpp) foreach(FILE ${HEADERS}) get_filename_component(FILE_PATH "${FILE}" PATH) From 16524fbe5391d6c1b6282d9ef03341ea60190b3d Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:22 +0200 Subject: [PATCH 03/10] bitwise: Fix bit_or using bit_and argument combinations in backend --- simdpp/core/bit_or.h | 24 +++++++++++----------- simdpp/core/detail/get_expr_bitwise.h | 29 +++++++++++++++++---------- simdpp/detail/expr/bit_or.h | 2 +- simdpp/operators/bit_or.h | 24 +++++++++++----------- test/insn/bitwise.cc | 7 +++++++ 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/simdpp/core/bit_or.h b/simdpp/core/bit_or.h index 225419a4..59d967bf 100644 --- a/simdpp/core/bit_or.h +++ b/simdpp/core/bit_or.h @@ -40,74 +40,74 @@ typename detail::get_expr_bit_or::type // support scalar arguments template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const unsigned& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const unsigned long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const unsigned long long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const int& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const long long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const unsigned& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const unsigned long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const unsigned long long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const int& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type bit_or(const any_vec& a, const long long& b) { return { { a.wrapped(), b } }; diff --git a/simdpp/core/detail/get_expr_bitwise.h b/simdpp/core/detail/get_expr_bitwise.h index dd30be5f..58f18823 100644 --- a/simdpp/core/detail/get_expr_bitwise.h +++ b/simdpp/core/detail/get_expr_bitwise.h @@ -132,36 +132,43 @@ struct get_expr_bitwise2_and { */ template -class get_expr_bit_or { +struct get_expr_bitwise2_or_impl { + using tags = expr2_maybe_scalar_tags; // (size_tag) get the size tag of the resulting expression - static const unsigned size_tag = V1::size_tag > V2::size_tag ? V1::size_tag : V2::size_tag; + static const unsigned size_tag = tags::v1_size_tag > tags::v2_size_tag + ? tags::v1_size_tag : tags::v2_size_tag; // (type_tag) get the type tag of the expression. We compute it in the same // way get_expr2 computes them, i.e. // type_tag == get_expr2::type::type_tag - static const unsigned type_tag_t1 = V1::type_tag > V2::type_tag ? V1::type_tag : V2::type_tag; + static const unsigned type_tag_t1 = tags::v1_type_tag > tags::v2_type_tag + ? tags::v1_type_tag : tags::v2_type_tag; static const bool is_mask_op1 = type_tag_t1 == SIMDPP_TAG_MASK_INT || type_tag_t1 == SIMDPP_TAG_MASK_FLOAT; - static const unsigned type_tag = (is_mask_op1 && V1::size_tag != V2::size_tag) + static const unsigned type_tag = + (is_mask_op1 && tags::v1_size_tag != tags::v2_size_tag) ? SIMDPP_TAG_UINT : type_tag_t1; // strip signed integer types - static const unsigned v12_type_tag = type_tag == SIMDPP_TAG_INT ? SIMDPP_TAG_UINT : type_tag; - + static const unsigned v12_type_tag = type_tag == SIMDPP_TAG_INT + ? SIMDPP_TAG_UINT : type_tag; -public: using v1_final_type = typename type_of_tag::type; + tags::length_bytes, void>::type; using v2_final_type = typename type_of_tag::type; + tags::length_bytes, void>::type; +}; - using type = typename type_of_tag +struct get_expr_bit_or { + using impl = get_expr_bitwise2_or_impl; + using type = typename type_of_tag>::type; }; - } // namespace detail } // namespace SIMDPP_ARCH_NAMESPACE } // namespace simdpp diff --git a/simdpp/detail/expr/bit_or.h b/simdpp/detail/expr/bit_or.h index 8c972edd..b24efe6e 100644 --- a/simdpp/detail/expr/bit_or.h +++ b/simdpp/detail/expr/bit_or.h @@ -25,7 +25,7 @@ template struct expr_eval> { static SIMDPP_INL R eval(const expr_bit_or& e) { - using E = get_expr_bitwise2_and_impl; + using E = get_expr_bitwise2_or_impl; return (R) insn::i_bit_or( eval_maybe_scalar_bitwise::eval(e.a), eval_maybe_scalar_bitwise::eval(e.b)); diff --git a/simdpp/operators/bit_or.h b/simdpp/operators/bit_or.h index 3c6ecc3d..d3a8f91a 100644 --- a/simdpp/operators/bit_or.h +++ b/simdpp/operators/bit_or.h @@ -41,74 +41,74 @@ typename detail::get_expr_bit_or::type // support scalar arguments template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const unsigned& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const unsigned long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const unsigned long long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const int& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const long long& a, const any_vec& b) { return { { a, b.wrapped() } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const unsigned& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const unsigned long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const unsigned long long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const int& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const long& b) { return { { a.wrapped(), b } }; } template SIMDPP_INL -typename detail::get_expr_bitwise2_and::type +typename detail::get_expr_bit_or::type operator|(const any_vec& a, const long long& b) { return { { a.wrapped(), b } }; diff --git a/test/insn/bitwise.cc b/test/insn/bitwise.cc index 94ea1f51..8cedcb6d 100644 --- a/test/insn/bitwise.cc +++ b/test/insn/bitwise.cc @@ -118,6 +118,13 @@ void test_bitwise_n(TestResultsSet& tc, TestReporter& tr) TEST_PUSH(tc, float32_n, bit_andnot(v.f32[i], m.f32[j])); TEST_PUSH(tc, float64_n, bit_andnot(v.f64[i], m.f64[j])); + TEST_PUSH(tc, uint8_n, bit_or(v.u8[i], m.u8[j])); + TEST_PUSH(tc, uint16_n, bit_or(v.u16[i], m.u16[j])); + TEST_PUSH(tc, uint32_n, bit_or(v.u32[i], m.u32[j])); + TEST_PUSH(tc, uint64_n, bit_or(v.u64[i], m.u64[j])); + TEST_PUSH(tc, float32_n, bit_or(v.f32[i], m.f32[j])); + TEST_PUSH(tc, float64_n, bit_or(v.f64[i], m.f64[j])); + // masks TEST_PUSH(tc, uint8_n, bit_and(m.u8[i], m.u8[j])); TEST_PUSH(tc, uint16_n, bit_and(m.u16[i], m.u16[j])); From 87346665f251e06b6ab2d95ab98f4f00522062fe Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:23 +0200 Subject: [PATCH 04/10] doc: Fix signature of insert() --- doc/wiki/misc/insert.mwiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/wiki/misc/insert.mwiki b/doc/wiki/misc/insert.mwiki index f1d37091..c9431f0d 100644 --- a/doc/wiki/misc/insert.mwiki +++ b/doc/wiki/misc/insert.mwiki @@ -3,7 +3,7 @@ {{dcl begin}} {{dcl | template< unsigned K, unsigned N, class E > -Ret extract( const Vec1& a, const El& el ); +Ret insert( const Vec1& a, El el ); }} {{dcl end}} From e9311e718cf8c4a190e7fdd4b2ddd3b882ee48bb Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:24 +0200 Subject: [PATCH 05/10] doc: Fix equivalent operation of test_bits_any() --- doc/wiki/misc/test_bits_any.mwiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/wiki/misc/test_bits_any.mwiki b/doc/wiki/misc/test_bits_any.mwiki index 499078fd..366a31e1 100644 --- a/doc/wiki/misc/test_bits_any.mwiki +++ b/doc/wiki/misc/test_bits_any.mwiki @@ -19,7 +19,7 @@ Checks whether any bits are set in the given vector. ===Equivalent operation=== {{source|1= -r = (bool)(a0 & a1 & a2 & ... & aN) +r = (bool)(a0 {{!}} a1 {{!}} a2 {{!}} ... {{!}} aN) }} ===See also=== From fadf2f7b02e10bd5b56a0fe0b3e2c4d39796f68f Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:27:25 +0200 Subject: [PATCH 06/10] doc: Fix for_each() title and signature --- doc/wiki/misc/for_each.mwiki | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/wiki/misc/for_each.mwiki b/doc/wiki/misc/for_each.mwiki index 61826a92..edf1519e 100644 --- a/doc/wiki/misc/for_each.mwiki +++ b/doc/wiki/misc/for_each.mwiki @@ -1,9 +1,9 @@ -{{simdpp/title|bit_cast}} +{{simdpp/title|for_each}} {{misc/navbar}} {{dcl begin}} {{dcl | template -void for_each( const any_vec& v, const F& function ); +void for_each( const any_vec& v, F function ); }} {{dcl end}} From 3445b3991861d97c5b20823d81c2aca2f7417bf7 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 21:47:00 +0200 Subject: [PATCH 07/10] doc: Add "See also" section to pages of make_*() functions --- doc/wiki/misc/make_float.mwiki | 5 ++++- doc/wiki/misc/make_int.mwiki | 5 ++++- doc/wiki/misc/make_uint.mwiki | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/wiki/misc/make_float.mwiki b/doc/wiki/misc/make_float.mwiki index 2514a32f..1e7563d8 100644 --- a/doc/wiki/misc/make_float.mwiki +++ b/doc/wiki/misc/make_float.mwiki @@ -83,4 +83,7 @@ r = [ v0 v1 .. v7 v0 ... v7 ] }} ===See also=== -{{todo}} +{{dsc begin}} +{{dsc inc | misc/dsc make_int }} +{{dsc inc | misc/dsc make_uint }} +{{dsc end}} diff --git a/doc/wiki/misc/make_int.mwiki b/doc/wiki/misc/make_int.mwiki index 7f324900..93931df8 100644 --- a/doc/wiki/misc/make_int.mwiki +++ b/doc/wiki/misc/make_int.mwiki @@ -83,4 +83,7 @@ r = [ v0 v1 .. v7 v0 ... v7 ] }} ===See also=== -{{todo}} +{{dsc begin}} +{{dsc inc | misc/dsc make_uint }} +{{dsc inc | misc/dsc make_float }} +{{dsc end}} diff --git a/doc/wiki/misc/make_uint.mwiki b/doc/wiki/misc/make_uint.mwiki index 50747800..82ade185 100644 --- a/doc/wiki/misc/make_uint.mwiki +++ b/doc/wiki/misc/make_uint.mwiki @@ -83,4 +83,7 @@ r = [ v0 v1 .. v7 v0 ... v7 ] }} ===See also=== -{{todo}} +{{dsc begin}} +{{dsc inc | misc/dsc make_int }} +{{dsc inc | misc/dsc make_float }} +{{dsc end}} From c27dfae319487596fb5c434bea64c8c2f57f447b Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 14 Jan 2018 22:01:02 +0200 Subject: [PATCH 08/10] doc: Explain the difference between make_int, make_uint and make_float --- doc/wiki/misc/make_float.mwiki | 2 ++ doc/wiki/misc/make_int.mwiki | 2 ++ doc/wiki/misc/make_uint.mwiki | 2 ++ 3 files changed, 6 insertions(+) diff --git a/doc/wiki/misc/make_float.mwiki b/doc/wiki/misc/make_float.mwiki index 1e7563d8..e5ddb679 100644 --- a/doc/wiki/misc/make_float.mwiki +++ b/doc/wiki/misc/make_float.mwiki @@ -50,6 +50,8 @@ The first set of overloads loads to given non-mask vector type. The second set of overloads returns a value of unspecified type with which any non-mask vector can be initialized. E.g. {{c|1=uint32<4> x = make_float(1, 2, 3, 4);}} +The difference between {{ltf|misc/make_int}}, {{ltf|misc/make_uint}} and {{ltf|misc/make_float}} functions is only in the types of the parameters. The reason for existence of separate functions is to make coercion of literals of different types easier. Assigning e.g. {{c|make_int(2)}}, {{c|make_uint(2)}} or {{c|make_float(2)}} to a vector of any type will result in the same behavior: all elements within the vector will be set to 2. The bitwise representation of the resulting vectors will be different depending on the type of the vector. + ===Parameters=== {{par begin}} {{par | v0, ..., v15 | the values to initialize the vector to}} diff --git a/doc/wiki/misc/make_int.mwiki b/doc/wiki/misc/make_int.mwiki index 93931df8..e4d9cf61 100644 --- a/doc/wiki/misc/make_int.mwiki +++ b/doc/wiki/misc/make_int.mwiki @@ -50,6 +50,8 @@ The first set of overloads loads to given non-mask vector type. The second set of overloads returns a value of unspecified type with which any non-mask vector can be initialized. E.g. {{c|1=int32<4> x = make_int(1, 2, 3, 4);}} +The difference between {{ltf|misc/make_int}}, {{ltf|misc/make_uint}} and {{ltf|misc/make_float}} functions is only in the types of the parameters. The reason for existence of separate functions is to make coercion of literals of different types easier. Assigning e.g. {{c|make_int(2)}}, {{c|make_uint(2)}} or {{c|make_float(2)}} to a vector of any type will result in the same behavior: all elements within the vector will be set to 2. The bitwise representation of the resulting vectors will be different depending on the type of the vector. + ===Parameters=== {{par begin}} {{par | v0, ..., v15 | the values to initialize the vector to}} diff --git a/doc/wiki/misc/make_uint.mwiki b/doc/wiki/misc/make_uint.mwiki index 82ade185..c2f2d7d4 100644 --- a/doc/wiki/misc/make_uint.mwiki +++ b/doc/wiki/misc/make_uint.mwiki @@ -50,6 +50,8 @@ The first set of overloads loads to given non-mask vector type. The second set of overloads returns a value of unspecified type with which any non-mask vector can be initialized. E.g. {{c|1=uint32<4> x = make_uint(1, 2, 3, 4);}} +The difference between {{ltf|misc/make_int}}, {{ltf|misc/make_uint}} and {{ltf|misc/make_float}} functions is only in the types of the parameters. The reason for existence of separate functions is to make coercion of literals of different types easier. Assigning e.g. {{c|make_int(2)}}, {{c|make_uint(2)}} or {{c|make_float(2)}} to a vector of any type will result in the same behavior: all elements within the vector will be set to 2. The bitwise representation of the resulting vectors will be different depending on the type of the vector. + ===Parameters=== {{par begin}} {{par | v0, ..., v15 | the values to initialize the vector to}} From 0be2e6b430e08f1d7b4b2c2b7d9850fa31e3d38a Mon Sep 17 00:00:00 2001 From: Hannes Petur Eggertsson Date: Fri, 20 Apr 2018 15:04:01 +0000 Subject: [PATCH 09/10] Possible fix for GCC 7.3.1 c++17 compilation error. --- simdpp/detail/insn/cmp_neq.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/simdpp/detail/insn/cmp_neq.h b/simdpp/detail/insn/cmp_neq.h index 1cac69bc..70e7ea1f 100644 --- a/simdpp/detail/insn/cmp_neq.h +++ b/simdpp/detail/insn/cmp_neq.h @@ -192,7 +192,7 @@ mask_int64x2 i_cmp_neq(const uint64x2& a, const uint64x2& b) return bit_not(cmp_eq(a, b)); #elif SIMDPP_USE_SSE2 uint64x2 r32, r32s; - r32 = (uint32x4)cmp_eq(uint32x4(a), uint32x4(b)); + r32 = cmp_eq(uint32x4(a), uint32x4(b)); // swap the 32-bit halves r32s = bit_or(shift_l<32>(r32), shift_r<32>(r32)); // combine the results. Each 32-bit half is ORed with the neighbouring pair @@ -381,4 +381,3 @@ typename V::mask_vector_type i_cmp_neq(const V& a, const V& b) } // namespace simdpp #endif - From eaf73dcab22ef035ce55df45a56e0f813f8c9949 Mon Sep 17 00:00:00 2001 From: Bill Barton Date: Thu, 30 May 2019 11:39:51 -0700 Subject: [PATCH 10/10] #132: correct typo --- simdpp/detail/insn/f_sqrt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simdpp/detail/insn/f_sqrt.h b/simdpp/detail/insn/f_sqrt.h index e3def602..64a85a1a 100644 --- a/simdpp/detail/insn/f_sqrt.h +++ b/simdpp/detail/insn/f_sqrt.h @@ -36,7 +36,7 @@ float32x4 i_sqrt(const float32x4& a) return r; #elif SIMDPP_USE_SSE2 return _mm_sqrt_ps(a.native()); -#elif SIMPDP_USE_NEON64 +#elif SIMDPP_USE_NEON64 return vsqrtq_f32(a.native()); #elif SIMDPP_USE_NEON_FLT_SP || SIMDPP_USE_ALTIVEC float32x4 x;