| 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_LOAD_PACKED3_H |
| 9 | #define LIBSIMDPP_SIMDPP_CORE_LOAD_PACKED3_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/load_packed3.h> |
| 17 | |
| 18 | namespace simdpp { |
| 19 | namespace SIMDPP_ARCH_NAMESPACE { |
| 20 | |
| 21 | |
| 22 | /** Loads values packed in triplets, de-interleaves them and stores the result |
| 23 | into three vectors. |
| 24 | |
| 25 | @code |
| 26 | a = [ *(p), *(p+3), *(p+6), ... , *(p+M*3-3) ] |
| 27 | b = [ *(p+1), *(p+4), *(p+7), ... , *(p+M*3-2) ] |
| 28 | c = [ *(p+2), *(p+5), *(p+8), ... , *(p+M*3-1) ] |
| 29 | @endcode |
| 30 | |
| 31 | Here M is the number of elements in the vector |
| 32 | |
| 33 | @a p must be aligned to the vector size in bytes |
| 34 | */ |
| 35 | template<unsigned N, class V, class T> SIMDPP_INL |
| 36 | void load_packed3(any_vec<N,V>& a, any_vec<N,V>& b, any_vec<N,V>& c, |
| 37 | const T* p) |
| 38 | { |
| 39 | static_assert(!is_mask<V>::value, "Mask types can not be loaded" ); |
| 40 | typename detail::get_expr_nosign<V>::type ra, rb, rc; |
| 41 | detail::insn::i_load_packed3(ra, rb, rc, reinterpret_cast<const char*>(p)); |
| 42 | a.wrapped() = ra; |
| 43 | b.wrapped() = rb; |
| 44 | c.wrapped() = rc; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | } // namespace SIMDPP_ARCH_NAMESPACE |
| 49 | } // namespace simdpp |
| 50 | |
| 51 | #endif |
| 52 | |
| 53 | |