xsimd_include.hpp 2.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay                     *
*                                                                          *
* Distributed under the terms of the BSD 3-Clause License.                 *
*                                                                          *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XSIMD_INCLUDE_HPP
#define XSIMD_INCLUDE_HPP

#include "xsimd_instruction_set.hpp"

// X86 intruction sets
#if XSIMD_X86_INSTR_SET >= XSIMD_X86_FMA3_VERSION // FMA3 and later
    #ifdef __GNUC__
        #include <x86intrin.h>         // x86intrin.h includes header files for whatever instruction
                                       // sets are specified on the compiler command line, such as:
                                       // xopintrin.h, fma4intrin.h
    #else
        #include <immintrin.h>         // MS version of immintrin.h covers AVX, AVX2 and FMA3
    #endif // __GNUC__
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_AVX_VERSION
    #include <immintrin.h>             // AVX
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE4_2_VERSION
    #include <nmmintrin.h>             // SSE4.2
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE4_1_VERSION
    #include <smmintrin.h>             // SSE4.1
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSSE3_VERSION
    #include <tmmintrin.h>             // SSSE3
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE3_VERSION
    #include <pmmintrin.h>             // SSE3
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE2_VERSION
    #include <emmintrin.h>             // SSE2
#elif XSIMD_X8_INSTR_SET == XSIMD_X86_SSE_VERSION
    #include <xmmintrin.h>             // SSE
#endif // XSIMD_X86_INSTR_SET

// AMD instruction sets
#if XSIMD_X86_AMD_INSTR_SET >= XSIMD_X86_AMD_FMA4_VERSION
    #ifdef _MSC_VER
        #include <intrin.h>
    #else
        #include <x86intrin.h>
        #if XSIMD_X86_AMD_INSTR_SET >= XSIMD_X86_AMD_XOP_VERSION
            #include <xopintrin.h>
        #else
            #include <fma4intrin.h>
        #endif
    #endif //  _MSC_VER
#elif XSIMD_X86_AMD_INSTR_SET == XSIMD_X86_AMD_SSE4A_VERSION
    #include <ammintrin.h>
#endif // XSIMD_X86_AMD_INSTR_SET

#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM7_NEON_VERSION
    #include <arm_neon.h>
#endif

// TODO: add ALTIVEC instruction set

#endif