1 | /* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt> |
2 | |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef LIBSIMDPP_SIMDPP_CORE_STORE_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_STORE_H |
10 | |
11 | #ifndef LIBSIMDPP_SIMD_H |
12 | #error "This file must be included through simd.h" |
13 | #endif |
14 | |
15 | #include <simdpp/types.h> |
16 | #include <simdpp/detail/insn/store.h> |
17 | |
18 | namespace simdpp { |
19 | namespace SIMDPP_ARCH_NAMESPACE { |
20 | |
21 | /** Stores a 128-bit or 256-bit integer vector to an aligned memory location. |
22 | |
23 | @par 128-bit version: |
24 | |
25 | @code |
26 | *(p) = a[0..127] |
27 | @endcode |
28 | @a p must be aligned to 16 bytes. |
29 | |
30 | @par 256-bit version: |
31 | |
32 | @code |
33 | *(p) = a[0..255] |
34 | @endcode |
35 | @a p must be aligned to 32 bytes. |
36 | @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2} |
37 | @icost{AVX (integer vectors), 2} |
38 | */ |
39 | template<class T, unsigned N, class V> SIMDPP_INL |
40 | void store(T* p, const any_vec<N,V>& a) |
41 | { |
42 | static_assert(!is_mask<V>::value, "Masks can not be stored" ); // FIXME: automatically convert |
43 | detail::insn::i_store(reinterpret_cast<char*>(p), a.wrapped().eval()); |
44 | } |
45 | |
46 | } // namespace SIMDPP_ARCH_NAMESPACE |
47 | } // namespace simdpp |
48 | |
49 | #endif |
50 | |
51 | |