From c5e9d93849d2c5d240642a85de2f65eeaecc6777 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 24 Aug 2021 16:56:04 +0200 Subject: [PATCH] Updated README --- README.md | 36 ++++++++++++++++- include/xsimd/types/xsimd_traits.hpp | 59 ---------------------------- 2 files changed, 34 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index ff14e2ad0..27aa1a767 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,39 @@ http://xsimd.readthedocs.io/ ## Usage -### Explicit use of an instruction set extension +The version 8 of the library is a complete rewrite and there are some slight differences with 7.x versions. +A migration guide will be available soon. In the meanwhile, the following examples show how to use both versions +7 and 8 of the library? + +### Explicit use of an instruction set extension (8.x) + +Here is an example that computes the mean of two sets of 4 double floating point values, assuming AVX extension is supported: +```cpp +#include +#include "xsimd/xsimd.hpp" + +namespace xs = xsimd; + +int main(int argc, char* argv[]) +{ + xs::batch a(1.5, 2.5, 3.5, 4.5); + xs::batch b(2.5, 3.5, 4.5, 5.5); + auto mean = (a + b) / 2; + std::cout << mean << std::endl; + return 0; +} +``` + +Do not forget to enable AVX extension when building the example. With gcc or clang, this is done with the `-march=native` flag, +on MSVC you have to pass the `/arch:AVX` option. + +This example outputs: + +```cpp +(2.0, 3.0, 4.0, 5.0) +``` + +### Explicit use of an instruction set extension (7.x and 8.x) Here is an example that computes the mean of two sets of 4 double floating point values, assuming AVX extension is supported: ```cpp @@ -100,7 +132,7 @@ This example outputs: (2.0, 3.0, 4.0, 5.0) ``` -### Auto detection of the instruction set extension to be used +### Auto detection of the instruction set extension to be used (7.x) The same computation operating on vectors and using the most performant instruction set available: diff --git a/include/xsimd/types/xsimd_traits.hpp b/include/xsimd/types/xsimd_traits.hpp index 77f644f53..1ce0ef3ff 100644 --- a/include/xsimd/types/xsimd_traits.hpp +++ b/include/xsimd/types/xsimd_traits.hpp @@ -81,43 +81,6 @@ namespace xsimd template using revert_simd_type = typename revert_simd_traits::type; - -// TODO: we have a problem here since the specialization for -// batch> does not exit anymore -/*#ifdef XSIMD_ENABLE_XTL_COMPLEX - template - struct simd_traits> - { - using type = batch, XSIMD_BATCH_FLOAT_SIZE>; - using bool_type = typename simd_batch_traits::batch_bool_type; - static constexpr size_t size = type::size; - }; - - template - struct revert_simd_traits, XSIMD_BATCH_FLOAT_SIZE>> - { - using type = xtl::xcomplex; - static constexpr size_t size = simd_traits::size; - }; -#endif // XSIMD_ENABLE_XTL_COMPLEX -*/ -/*#ifdef XSIMD_ENABLE_XTL_COMPLEX - template - struct simd_traits> - { - using type = batch, XSIMD_BATCH_DOUBLE_SIZE>; - using bool_type = typename simd_batch_traits::batch_bool_type; - static constexpr size_t size = type::size; - }; - - template - struct revert_simd_traits, XSIMD_BATCH_DOUBLE_SIZE>> - { - using type = xtl::xcomplex; - static constexpr size_t size = simd_traits::size; - }; -#endif // XSIMD_ENABLE_XTL_COMPLEX*/ - /******************** * simd_return_type * ********************/ @@ -174,20 +137,6 @@ namespace xsimd : std::enable_if::value, batch, A>> { }; - -/*#ifdef XSIMD_ENABLE_XTL_COMPLEX - template - struct simd_return_type_impl, T2, N> - : std::enable_if::value, batch, N>> - { - }; - - template - struct simd_return_type_impl, xtl::xcomplex, N> - : std::enable_if::value, batch, N>> - { - }; -#endif // XSIMD_ENABLE_XTL_COMPLEX*/ } template @@ -234,14 +183,6 @@ namespace xsimd struct is_batch_complex, A>> : std::true_type { }; -/* -#ifdef XSIMD_ENABLE_XTL_COMPLEX - template - struct is_batch_complex, N>> : std::true_type - { - }; -#endif //XSIMD_ENABLE_XTL_COMPLEX*/ - } #endif