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_STREAM_H
9#define LIBSIMDPP_SIMDPP_CORE_STREAM_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/stream.h>
17
18namespace simdpp {
19namespace SIMDPP_ARCH_NAMESPACE {
20
21
22/** Stores a 128-bit or 256-bit integer, 32-bit or 64-bit floating point vector
23 to memory without polluting the caches, if possible.
24
25 @par 128-bit version:
26
27 @code
28 *(p) = a[0..127]
29 @endcode
30 @a p must be aligned to 16 bytes.
31
32 @par 256-bit version:
33
34 @code
35 *(p) = a[0..255]
36 @endcode
37 @a p must be aligned to 32 bytes.
38 @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
39 @icost{AVX (integer vectors), 2}
40*/
41template<class T, unsigned N, class V> SIMDPP_INL
42void stream(T* p, const any_vec<N,V>& a)
43{
44 static_assert(!is_mask<V>::value, "Masks can not be stored"); // FIXME: convert automatically
45 detail::insn::i_stream(reinterpret_cast<char*>(p), a.wrapped().eval());
46}
47
48} // namespace SIMDPP_ARCH_NAMESPACE
49} // namespace simdpp
50
51#endif
52
53