1/* Copyright (C) 2011-2012 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_DETAIL_NULL_TRANSPOSE_H
9#define LIBSIMDPP_DETAIL_NULL_TRANSPOSE_H
10#if SIMDPP_USE_NULL || SIMDPP_USE_NEON32 || SIMDPP_USE_ALTIVEC
11
12#ifndef LIBSIMDPP_SIMD_H
13 #error "This file must be included through simd.h"
14#endif
15
16#include <simdpp/types.h>
17#include <utility>
18
19namespace simdpp {
20namespace SIMDPP_ARCH_NAMESPACE {
21namespace detail {
22namespace null {
23
24template<class V> SIMDPP_INL
25void transpose2(V& a0, V& a1)
26{
27 for (unsigned j = 0; j < V::length; j+=2) {
28 std::swap(a0.el(j+1), a1.el(j));
29 }
30}
31
32template<class V> SIMDPP_INL
33void transpose4(V& a0, V& a1, V& a2, V& a3)
34{
35 for (unsigned j = 0; j < V::length; j+=4) {
36 std::swap(a0.el(j+1), a1.el(j));
37 std::swap(a0.el(j+2), a2.el(j));
38 std::swap(a0.el(j+3), a3.el(j));
39 std::swap(a1.el(j+2), a2.el(j+1));
40 std::swap(a1.el(j+3), a3.el(j+1));
41 std::swap(a2.el(j+3), a3.el(j+2));
42 }
43}
44
45} // namespace null
46} // namespace detail
47} // namespace SIMDPP_ARCH_NAMESPACE
48} // namespace simdpp
49
50#endif
51#endif
52