1 | /* |
2 | Copyright Charly Chevalier 2015 |
3 | Copyright Joel Falcou 2015 |
4 | Distributed under the Boost Software License, Version 1.0. |
5 | (See accompanying file LICENSE_1_0.txt or copy at |
6 | http://www.boost.org/LICENSE_1_0.txt) |
7 | */ |
8 | |
9 | #ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_H |
10 | #define BOOST_PREDEF_HARDWARE_SIMD_X86_H |
11 | |
12 | #include <boost/predef/version_number.h> |
13 | #include <boost/predef/hardware/simd/x86/versions.h> |
14 | |
15 | /* tag::reference[] |
16 | = `BOOST_HW_SIMD_X86` |
17 | |
18 | The SIMD extension for x86 (*if detected*). |
19 | Version number depends on the most recent detected extension. |
20 | |
21 | [options="header"] |
22 | |=== |
23 | | {predef_symbol} | {predef_version} |
24 | |
25 | | `+__SSE__+` | {predef_detection} |
26 | | `+_M_X64+` | {predef_detection} |
27 | | `_M_IX86_FP >= 1` | {predef_detection} |
28 | |
29 | | `+__SSE2__+` | {predef_detection} |
30 | | `+_M_X64+` | {predef_detection} |
31 | | `_M_IX86_FP >= 2` | {predef_detection} |
32 | |
33 | | `+__SSE3__+` | {predef_detection} |
34 | |
35 | | `+__SSSE3__+` | {predef_detection} |
36 | |
37 | | `+__SSE4_1__+` | {predef_detection} |
38 | |
39 | | `+__SSE4_2__+` | {predef_detection} |
40 | |
41 | | `+__AVX__+` | {predef_detection} |
42 | |
43 | | `+__FMA__+` | {predef_detection} |
44 | |
45 | | `+__AVX2__+` | {predef_detection} |
46 | |=== |
47 | |
48 | [options="header"] |
49 | |=== |
50 | | {predef_symbol} | {predef_version} |
51 | |
52 | | `+__SSE__+` | BOOST_HW_SIMD_X86_SSE_VERSION |
53 | | `+_M_X64+` | BOOST_HW_SIMD_X86_SSE_VERSION |
54 | | `_M_IX86_FP >= 1` | BOOST_HW_SIMD_X86_SSE_VERSION |
55 | |
56 | | `+__SSE2__+` | BOOST_HW_SIMD_X86_SSE2_VERSION |
57 | | `+_M_X64+` | BOOST_HW_SIMD_X86_SSE2_VERSION |
58 | | `_M_IX86_FP >= 2` | BOOST_HW_SIMD_X86_SSE2_VERSION |
59 | |
60 | | `+__SSE3__+` | BOOST_HW_SIMD_X86_SSE3_VERSION |
61 | |
62 | | `+__SSSE3__+` | BOOST_HW_SIMD_X86_SSSE3_VERSION |
63 | |
64 | | `+__SSE4_1__+` | BOOST_HW_SIMD_X86_SSE4_1_VERSION |
65 | |
66 | | `+__SSE4_2__+` | BOOST_HW_SIMD_X86_SSE4_2_VERSION |
67 | |
68 | | `+__AVX__+` | BOOST_HW_SIMD_X86_AVX_VERSION |
69 | |
70 | | `+__FMA__+` | BOOST_HW_SIMD_X86_FMA3_VERSION |
71 | |
72 | | `+__AVX2__+` | BOOST_HW_SIMD_X86_AVX2_VERSION |
73 | |=== |
74 | |
75 | */ // end::reference[] |
76 | |
77 | #define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE |
78 | |
79 | #undef BOOST_HW_SIMD_X86 |
80 | #if !defined(BOOST_HW_SIMD_X86) && defined(__MIC__) |
81 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MIC_VERSION |
82 | #endif |
83 | #if !defined(BOOST_HW_SIMD_X86) && defined(__AVX2__) |
84 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX2_VERSION |
85 | #endif |
86 | #if !defined(BOOST_HW_SIMD_X86) && defined(__AVX__) |
87 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX_VERSION |
88 | #endif |
89 | #if !defined(BOOST_HW_SIMD_X86) && defined(__FMA__) |
90 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_FMA_VERSION |
91 | #endif |
92 | #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_2__) |
93 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_2_VERSION |
94 | #endif |
95 | #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_1__) |
96 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_1_VERSION |
97 | #endif |
98 | #if !defined(BOOST_HW_SIMD_X86) && defined(__SSSE3__) |
99 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSSE3_VERSION |
100 | #endif |
101 | #if !defined(BOOST_HW_SIMD_X86) && defined(__SSE3__) |
102 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE3_VERSION |
103 | #endif |
104 | #if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) |
105 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE2_VERSION |
106 | #endif |
107 | #if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) |
108 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE_VERSION |
109 | #endif |
110 | #if !defined(BOOST_HW_SIMD_X86) && defined(__MMX__) |
111 | # define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MMX_VERSION |
112 | #endif |
113 | |
114 | #if !defined(BOOST_HW_SIMD_X86) |
115 | # define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE |
116 | #else |
117 | # define BOOST_HW_SIMD_X86_AVAILABLE |
118 | #endif |
119 | |
120 | #define BOOST_HW_SIMD_X86_NAME "x86 SIMD" |
121 | |
122 | #endif |
123 | |
124 | #include <boost/predef/detail/test.h> |
125 | BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86, BOOST_HW_SIMD_X86_NAME) |
126 | |