]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_AMD_H | |
10 | #define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H | |
11 | ||
12 | #include <boost/predef/version_number.h> | |
13 | #include <boost/predef/hardware/simd/x86_amd/versions.h> | |
14 | ||
15 | /*` | |
16 | [heading `BOOST_HW_SIMD_X86_AMD`] | |
17 | ||
18 | The SIMD extension for x86 (AMD) (*if detected*). | |
19 | Version number depends on the most recent detected extension. | |
20 | ||
21 | [table | |
22 | [[__predef_symbol__] [__predef_version__]] | |
23 | ||
24 | [[`__SSE4A__`] [__predef_detection__]] | |
25 | ||
26 | [[`__FMA4__`] [__predef_detection__]] | |
27 | ||
28 | [[`__XOP__`] [__predef_detection__]] | |
29 | ||
30 | [[`BOOST_HW_SIMD_X86`] [__predef_detection__]] | |
31 | ] | |
32 | ||
33 | [table | |
34 | [[__predef_symbol__] [__predef_version__]] | |
35 | ||
36 | [[`__SSE4A__`] [BOOST_HW_SIMD_X86_SSE4A_VERSION]] | |
37 | ||
38 | [[`__FMA4__`] [BOOST_HW_SIMD_X86_FMA4_VERSION]] | |
39 | ||
40 | [[`__XOP__`] [BOOST_HW_SIMD_X86_XOP_VERSION]] | |
41 | ||
42 | [[`BOOST_HW_SIMD_X86`] [BOOST_HW_SIMD_X86]] | |
43 | ] | |
44 | ||
45 | [note This predef includes every other x86 SIMD extensions and also has other | |
46 | more specific extensions (FMA4, XOP, SSE4a). You should use this predef | |
47 | instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have | |
48 | been detected.] | |
49 | ||
50 | */ | |
51 | ||
52 | #define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE | |
53 | ||
54 | // AMD CPUs also use x86 architecture. We first try to detect if any AMD | |
55 | // specific extension are detected, if yes, then try to detect more recent x86 | |
56 | // common extensions. | |
57 | ||
58 | #undef BOOST_HW_SIMD_X86_AMD | |
59 | #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__XOP__) | |
60 | # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_XOP_VERSION | |
61 | #endif | |
62 | #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__FMA4__) | |
63 | # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_FMA4_VERSION | |
64 | #endif | |
65 | #if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__SSE4A__) | |
66 | # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION | |
67 | #endif | |
68 | ||
69 | #if !defined(BOOST_HW_SIMD_X86_AMD) | |
70 | # define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE | |
71 | #else | |
72 | // At this point, we know that we have an AMD CPU, we do need to check for | |
73 | // other x86 extensions to determine the final version number. | |
74 | # include <boost/predef/hardware/simd/x86.h> | |
75 | # if BOOST_HW_SIMD_X86 > BOOST_HW_SIMD_X86_AMD | |
76 | # undef BOOST_HW_SIMD_X86_AMD | |
77 | # define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86 | |
78 | # endif | |
79 | # define BOOST_HW_SIMD_X86_AMD_AVAILABLE | |
80 | #endif | |
81 | ||
82 | #define BOOST_HW_SIMD_X86_AMD_NAME "x86 (AMD) SIMD" | |
83 | ||
84 | #endif | |
85 | ||
86 | #include <boost/predef/detail/test.h> | |
87 | BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME) |