Skip to content

Commit c5e9d93

Browse files
committed
Updated README
1 parent 8bf4845 commit c5e9d93

File tree

2 files changed

+34
-61
lines changed

2 files changed

+34
-61
lines changed

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,39 @@ http://xsimd.readthedocs.io/
7272

7373
## Usage
7474

75-
### Explicit use of an instruction set extension
75+
The version 8 of the library is a complete rewrite and there are some slight differences with 7.x versions.
76+
A migration guide will be available soon. In the meanwhile, the following examples show how to use both versions
77+
7 and 8 of the library?
78+
79+
### Explicit use of an instruction set extension (8.x)
80+
81+
Here is an example that computes the mean of two sets of 4 double floating point values, assuming AVX extension is supported:
82+
```cpp
83+
#include <iostream>
84+
#include "xsimd/xsimd.hpp"
85+
86+
namespace xs = xsimd;
87+
88+
int main(int argc, char* argv[])
89+
{
90+
xs::batch<double, xs::avx2> a(1.5, 2.5, 3.5, 4.5);
91+
xs::batch<double, xs::avx2> b(2.5, 3.5, 4.5, 5.5);
92+
auto mean = (a + b) / 2;
93+
std::cout << mean << std::endl;
94+
return 0;
95+
}
96+
```
97+
98+
Do not forget to enable AVX extension when building the example. With gcc or clang, this is done with the `-march=native` flag,
99+
on MSVC you have to pass the `/arch:AVX` option.
100+
101+
This example outputs:
102+
103+
```cpp
104+
(2.0, 3.0, 4.0, 5.0)
105+
```
106+
107+
### Explicit use of an instruction set extension (7.x and 8.x)
76108

77109
Here is an example that computes the mean of two sets of 4 double floating point values, assuming AVX extension is supported:
78110
```cpp
@@ -100,7 +132,7 @@ This example outputs:
100132
(2.0, 3.0, 4.0, 5.0)
101133
```
102134

103-
### Auto detection of the instruction set extension to be used
135+
### Auto detection of the instruction set extension to be used (7.x)
104136

105137
The same computation operating on vectors and using the most performant instruction set available:
106138

include/xsimd/types/xsimd_traits.hpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -81,43 +81,6 @@ namespace xsimd
8181
template <class T>
8282
using revert_simd_type = typename revert_simd_traits<T>::type;
8383

84-
85-
// TODO: we have a problem here since the specialization for
86-
// batch<xtl::xcomplex<T, T, i3ec>> does not exit anymore
87-
/*#ifdef XSIMD_ENABLE_XTL_COMPLEX
88-
template <bool i3ec>
89-
struct simd_traits<xtl::xcomplex<float, float, i3ec>>
90-
{
91-
using type = batch<xtl::xcomplex<float, float, i3ec>, XSIMD_BATCH_FLOAT_SIZE>;
92-
using bool_type = typename simd_batch_traits<type>::batch_bool_type;
93-
static constexpr size_t size = type::size;
94-
};
95-
96-
template <bool i3ec>
97-
struct revert_simd_traits<batch<xtl::xcomplex<float, float, i3ec>, XSIMD_BATCH_FLOAT_SIZE>>
98-
{
99-
using type = xtl::xcomplex<float, float, i3ec>;
100-
static constexpr size_t size = simd_traits<type>::size;
101-
};
102-
#endif // XSIMD_ENABLE_XTL_COMPLEX
103-
*/
104-
/*#ifdef XSIMD_ENABLE_XTL_COMPLEX
105-
template <bool i3ec>
106-
struct simd_traits<xtl::xcomplex<double, double, i3ec>>
107-
{
108-
using type = batch<xtl::xcomplex<double, double, i3ec>, XSIMD_BATCH_DOUBLE_SIZE>;
109-
using bool_type = typename simd_batch_traits<type>::batch_bool_type;
110-
static constexpr size_t size = type::size;
111-
};
112-
113-
template <bool i3ec>
114-
struct revert_simd_traits<batch<xtl::xcomplex<double, double, i3ec>, XSIMD_BATCH_DOUBLE_SIZE>>
115-
{
116-
using type = xtl::xcomplex<double, double, i3ec>;
117-
static constexpr size_t size = simd_traits<type>::size;
118-
};
119-
#endif // XSIMD_ENABLE_XTL_COMPLEX*/
120-
12184
/********************
12285
* simd_return_type *
12386
********************/
@@ -174,20 +137,6 @@ namespace xsimd
174137
: std::enable_if<simd_condition<T1, T2>::value, batch<std::complex<T2>, A>>
175138
{
176139
};
177-
178-
/*#ifdef XSIMD_ENABLE_XTL_COMPLEX
179-
template <class T1, bool i3ec, class T2, std::size_t N>
180-
struct simd_return_type_impl<xtl::xcomplex<T1, T1, i3ec>, T2, N>
181-
: std::enable_if<simd_condition<T1, T2>::value, batch<xtl::xcomplex<T2, T2, i3ec>, N>>
182-
{
183-
};
184-
185-
template <class T1, class T2, bool i3ec, std::size_t N>
186-
struct simd_return_type_impl<xtl::xcomplex<T1, T1, i3ec>, xtl::xcomplex<T2, T2, i3ec>, N>
187-
: std::enable_if<simd_condition<T1, T2>::value, batch<xtl::xcomplex<T2, T2, i3ec>, N>>
188-
{
189-
};
190-
#endif // XSIMD_ENABLE_XTL_COMPLEX*/
191140
}
192141

193142
template <class T1, class T2, class A = default_arch>
@@ -234,14 +183,6 @@ namespace xsimd
234183
struct is_batch_complex<batch<std::complex<T>, A>> : std::true_type
235184
{
236185
};
237-
/*
238-
#ifdef XSIMD_ENABLE_XTL_COMPLEX
239-
template <class T, bool i3ec, std::size_t N>
240-
struct is_batch_complex<batch<xtl::xcomplex<T, T, i3ec>, N>> : std::true_type
241-
{
242-
};
243-
#endif //XSIMD_ENABLE_XTL_COMPLEX*/
244-
245186
}
246187

247188
#endif

0 commit comments

Comments
 (0)