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