]> git.uio.no Git - u/mrichter/AliRoot.git/blame - Vc/include/Vc/avx/prefetches.tcc
Vc package added (version 0.6.79-dev)
[u/mrichter/AliRoot.git] / Vc / include / Vc / avx / prefetches.tcc
CommitLineData
f22341db 1/* This file is part of the Vc library.
2
3 Copyright (C) 2010, 2011-2012 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_AVX_PREFETCHES_TCC
21#define VC_AVX_PREFETCHES_TCC
22
23namespace Vc
24{
25namespace Internal
26{
27
28inline ALWAYS_INLINE void HelperImpl<Vc::AVXImpl>::prefetchForOneRead(const void *addr)
29{
30 _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_NTA);
31}
32inline ALWAYS_INLINE void HelperImpl<Vc::AVXImpl>::prefetchClose(const void *addr)
33{
34 _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T0);
35}
36inline ALWAYS_INLINE void HelperImpl<Vc::AVXImpl>::prefetchMid(const void *addr)
37{
38 _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T1);
39}
40inline ALWAYS_INLINE void HelperImpl<Vc::AVXImpl>::prefetchFar(const void *addr)
41{
42 _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T2);
43}
44inline ALWAYS_INLINE void HelperImpl<Vc::AVXImpl>::prefetchForModify(const void *addr)
45{
46#ifdef __3dNOW__
47 _m_prefetchw(const_cast<void *>(addr));
48#else
49 _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T0);
50#endif
51}
52
53} // namespace Internal
54} // namespace Vc
55
56#endif // VC_AVX_PREFETCHES_TCC