]> git.uio.no Git - u/mrichter/AliRoot.git/blob - Vc/include/Vc/sse/helperimpl.h
Vc package added (version 0.6.79-dev)
[u/mrichter/AliRoot.git] / Vc / include / Vc / sse / helperimpl.h
1 /*  This file is part of the Vc library.
2
3     Copyright (C) 2010-2011 Matthias Kretz <kretz@kde.org>
4
5     Vc is free software: you can redistribute it and/or modify
6     it under the terms of the GNU Lesser General Public License as
7     published by the Free Software Foundation, either version 3 of
8     the License, or (at your option) any later version.
9
10     Vc is distributed in the hope that it will be useful, but
11     WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with Vc.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20 #ifndef VC_SSE_DEINTERLEAVE_H
21 #define VC_SSE_DEINTERLEAVE_H
22
23 #include "macros.h"
24
25 namespace Vc
26 {
27 namespace Internal
28 {
29
30 template<> struct HelperImpl<Vc::SSE2Impl>
31 {
32     typedef SSE::Vector<float> float_v;
33     typedef SSE::Vector<SSE::float8> sfloat_v;
34     typedef SSE::Vector<double> double_v;
35     typedef SSE::Vector<int> int_v;
36     typedef SSE::Vector<unsigned int> uint_v;
37     typedef SSE::Vector<short> short_v;
38     typedef SSE::Vector<unsigned short> ushort_v;
39
40     template<typename A> static void deinterleave(float_v &, float_v &, const float *, A);
41     template<typename A> static void deinterleave(float_v &, float_v &, const short *, A);
42     template<typename A> static void deinterleave(float_v &, float_v &, const unsigned short *, A);
43
44     template<typename A> static void deinterleave(sfloat_v &, sfloat_v &, const float *, A);
45     template<typename A> static void deinterleave(sfloat_v &, sfloat_v &, const short *, A);
46     template<typename A> static void deinterleave(sfloat_v &, sfloat_v &, const unsigned short *, A);
47
48     template<typename A> static void deinterleave(double_v &, double_v &, const double *, A);
49
50     template<typename A> static void deinterleave(int_v &, int_v &, const int *, A);
51     template<typename A> static void deinterleave(int_v &, int_v &, const short *, A);
52
53     template<typename A> static void deinterleave(uint_v &, uint_v &, const unsigned int *, A);
54     template<typename A> static void deinterleave(uint_v &, uint_v &, const unsigned short *, A);
55
56     template<typename A> static void deinterleave(short_v &, short_v &, const short *, A);
57
58     template<typename A> static void deinterleave(ushort_v &, ushort_v &, const unsigned short *, A);
59
60     static inline ALWAYS_INLINE_L void prefetchForOneRead(const void *addr) ALWAYS_INLINE_R;
61     static inline ALWAYS_INLINE_L void prefetchForModify(const void *addr) ALWAYS_INLINE_R;
62     static inline ALWAYS_INLINE_L void prefetchClose(const void *addr) ALWAYS_INLINE_R;
63     static inline ALWAYS_INLINE_L void prefetchMid(const void *addr) ALWAYS_INLINE_R;
64     static inline ALWAYS_INLINE_L void prefetchFar(const void *addr) ALWAYS_INLINE_R;
65
66     template<Vc::MallocAlignment A>
67     static inline ALWAYS_INLINE_L void *malloc(size_t n) ALWAYS_INLINE_R;
68     static inline ALWAYS_INLINE_L void free(void *p) ALWAYS_INLINE_R;
69 };
70
71 template<> struct HelperImpl<SSE3Impl> : public HelperImpl<SSE2Impl> {};
72 template<> struct HelperImpl<SSSE3Impl> : public HelperImpl<SSE3Impl> {};
73 template<> struct HelperImpl<SSE41Impl> : public HelperImpl<SSSE3Impl> {};
74 template<> struct HelperImpl<SSE42Impl> : public HelperImpl<SSE41Impl> {};
75 template<> struct HelperImpl<SSE4aImpl> : public HelperImpl<SSE3Impl> {};
76
77
78 } // namespace Internal
79 } // namespace Vc
80
81 #include "undomacros.h"
82 #include "deinterleave.tcc"
83 #include "prefetches.tcc"
84 #include "helperimpl.tcc"
85
86 #endif // VC_SSE_DEINTERLEAVE_H