1/*
2Copyright Charly Chevalier 2015
3Copyright Joel Falcou 2015
4Distributed under the Boost Software License, Version 1.0.
5(See accompanying file LICENSE_1_0.txt or copy at
6http://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/* tag::reference[]
16= `BOOST_HW_SIMD_X86_AMD`
17
18The SIMD extension for x86 (AMD) (*if detected*).
19Version number depends on the most recent detected extension.
20
21[options="header"]
22|===
23| {predef_symbol} | {predef_version}
24
25| `+__SSE4A__+` | {predef_detection}
26
27| `+__FMA4__+` | {predef_detection}
28
29| `+__XOP__+` | {predef_detection}
30
31| `BOOST_HW_SIMD_X86` | {predef_detection}
32|===
33
34[options="header"]
35|===
36| {predef_symbol} | {predef_version}
37
38| `+__SSE4A__+` | BOOST_HW_SIMD_X86_SSE4A_VERSION
39
40| `+__FMA4__+` | BOOST_HW_SIMD_X86_FMA4_VERSION
41
42| `+__XOP__+` | BOOST_HW_SIMD_X86_XOP_VERSION
43
44| `BOOST_HW_SIMD_X86` | BOOST_HW_SIMD_X86
45|===
46
47NOTE: This predef includes every other x86 SIMD extensions and also has other
48more specific extensions (FMA4, XOP, SSE4a). You should use this predef
49instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have
50been detected.
51
52*/ // end::reference[]
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>
89BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME)
90

source code of include/boost/predef/hardware/simd/x86_amd.h