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