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