early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -0,0 +1,168 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/predef/hardware/simd/x86.h>
#include <boost/predef/hardware/simd/x86_amd.h>
#include <boost/predef/hardware/simd/arm.h>
#include <boost/predef/hardware/simd/ppc.h>
#ifndef BOOST_PREDEF_HARDWARE_SIMD_H
#define BOOST_PREDEF_HARDWARE_SIMD_H
#include <boost/predef/version_number.h>
/* tag::reference[]
= Using the `BOOST_HW_SIMD_*` predefs
SIMD predefs depend on compiler options. For example, you will have to add the
option `-msse3` to clang or gcc to enable SSE3. SIMD predefs are also inclusive.
This means that if SSE3 is enabled, then every other extensions with a lower
version number will implicitly be enabled and detected. However, some extensions
are CPU specific, they may not be detected nor enabled when an upper version is
enabled.
NOTE: SSE(1) and SSE2 are automatically enabled by default when using x86-64
architecture.
To check if any SIMD extension has been enabled, you can use:
[source]
----
#include <boost/predef/hardware/simd.h>
#include <iostream>
int main()
{
#if defined(BOOST_HW_SIMD_AVAILABLE)
std::cout << "SIMD detected!" << std::endl;
#endif
return 0;
}
----
When writing SIMD specific code, you may want to check if a particular extension
has been detected. To do so you have to use the right architecture predef and
compare it. Those predef are of the form `BOOST_HW_SIMD_"ARCH"` (where `"ARCH"`
is either `ARM`, `PPC`, or `X86`). For example, if you compile code for x86
architecture, you will have to use `BOOST_HW_SIMD_X86`. Its value will be the
version number of the most recent SIMD extension detected for the architecture.
To check if an extension has been enabled:
[source]
----
#include <boost/predef/hardware/simd.h>
#include <iostream>
int main()
{
#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE3_VERSION
std::cout << "This is SSE3!" << std::endl;
#endif
return 0;
}
----
NOTE: The *_VERSION* defines that map version number to actual real
identifiers. This way it is easier to write comparisons without messing up with
version numbers.
To *"strictly"* check the most recent detected extension:
[source]
----
#include <boost/predef/hardware/simd.h>
#include <iostream>
int main()
{
#if BOOST_HW_SIMD_X86 == BOOST_HW_SIMD_X86_SSE3_VERSION
std::cout << "This is SSE3 and this is the most recent enabled extension!"
<< std::endl;
#endif
return 0;
}
----
Because of the version systems of predefs and of the inclusive property of SIMD
extensions macros, you can easily check for ranges of supported extensions:
[source]
----
#include <boost/predef/hardware/simd.h>
#include <iostream>
int main()
{
#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE2_VERSION &&\
BOOST_HW_SIMD_X86 <= BOOST_HW_SIMD_X86_SSSE3_VERSION
std::cout << "This is SSE2, SSE3 and SSSE3!" << std::endl;
#endif
return 0;
}
----
NOTE: Unlike gcc and clang, Visual Studio does not allow you to specify precisely
the SSE variants you want to use, the only detections that will take place are
SSE, SSE2, AVX and AVX2. For more informations,
see [@https://msdn.microsoft.com/en-us/library/b0084kay.aspx here].
*/ // end::reference[]
// We check if SIMD extension of multiples architectures have been detected,
// if yes, then this is an error!
//
// NOTE: _X86_AMD implies _X86, so there is no need to check for it here!
//
#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_PPC_AVAILABLE) ||\
defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) ||\
defined(BOOST_HW_SIMD_PPC_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE)
# error "Multiple SIMD architectures detected, this cannot happen!"
#endif
#if defined(BOOST_HW_SIMD_X86_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE)
// If both standard _X86 and _X86_AMD are available,
// then take the biggest version of the two!
# if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_AMD
# define BOOST_HW_SIMD BOOST_HW_SIMD_X86
# else
# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD
# endif
#endif
#if !defined(BOOST_HW_SIMD)
// At this point, only one of these two is defined
# if defined(BOOST_HW_SIMD_X86_AVAILABLE)
# define BOOST_HW_SIMD BOOST_HW_SIMD_X86
# endif
# if defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE)
# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD
# endif
#endif
#if defined(BOOST_HW_SIMD_ARM_AVAILABLE)
# define BOOST_HW_SIMD BOOST_HW_SIMD_ARM
#endif
#if defined(BOOST_HW_SIMD_PPC_AVAILABLE)
# define BOOST_HW_SIMD BOOST_HW_SIMD_PPC
#endif
#if defined(BOOST_HW_SIMD)
# define BOOST_HW_SIMD_AVAILABLE
#else
# define BOOST_HW_SIMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
#endif
#define BOOST_HW_SIMD_NAME "Hardware SIMD"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD, BOOST_HW_SIMD_NAME)

View File

@@ -0,0 +1,61 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_H
#define BOOST_PREDEF_HARDWARE_SIMD_ARM_H
#include <boost/predef/version_number.h>
#include <boost/predef/hardware/simd/arm/versions.h>
/* tag::reference[]
= `BOOST_HW_SIMD_ARM`
The SIMD extension for ARM (*if detected*).
Version number depends on the most recent detected extension.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__ARM_NEON__+` | {predef_detection}
| `+__aarch64__+` | {predef_detection}
| `+_M_ARM+` | {predef_detection}
| `+_M_ARM64+` | {predef_detection}
|===
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__ARM_NEON__+` | BOOST_HW_SIMD_ARM_NEON_VERSION
| `+__aarch64__+` | BOOST_HW_SIMD_ARM_NEON_VERSION
| `+_M_ARM+` | BOOST_HW_SIMD_ARM_NEON_VERSION
| `+_M_ARM64+` | BOOST_HW_SIMD_ARM_NEON_VERSION
|===
*/ // end::reference[]
#define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE
#undef BOOST_HW_SIMD_ARM
#if !defined(BOOST_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM) || defined (_M_ARM64))
# define BOOST_HW_SIMD_ARM BOOST_HW_SIMD_ARM_NEON_VERSION
#endif
#if !defined(BOOST_HW_SIMD_ARM)
# define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE
#else
# define BOOST_HW_SIMD_ARM_AVAILABLE
#endif
#define BOOST_HW_SIMD_ARM_NAME "ARM SIMD"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_ARM, BOOST_HW_SIMD_ARM_NAME)

View File

@@ -0,0 +1,38 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H
#define BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H
#include <boost/predef/version_number.h>
/* tag::reference[]
= `BOOST_HW_SIMD_ARM_*_VERSION`
Those defines represent ARM SIMD extensions versions.
NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_ARM`.
*/ // end::reference[]
// ---------------------------------
/* tag::reference[]
= `BOOST_HW_SIMD_ARM_NEON_VERSION`
The https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29[NEON]
ARM extension version number.
Version number is: *1.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_ARM_NEON_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
/* tag::reference[]
*/ // end::reference[]
#endif

View File

@@ -0,0 +1,71 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_H
#include <boost/predef/version_number.h>
#include <boost/predef/hardware/simd/ppc/versions.h>
/* tag::reference[]
= `BOOST_HW_SIMD_PPC`
The SIMD extension for PowerPC (*if detected*).
Version number depends on the most recent detected extension.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__VECTOR4DOUBLE__+` | {predef_detection}
| `+__ALTIVEC__+` | {predef_detection}
| `+__VEC__+` | {predef_detection}
| `+__VSX__+` | {predef_detection}
|===
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__VECTOR4DOUBLE__+` | BOOST_HW_SIMD_PPC_QPX_VERSION
| `+__ALTIVEC__+` | BOOST_HW_SIMD_PPC_VMX_VERSION
| `+__VEC__+` | BOOST_HW_SIMD_PPC_VMX_VERSION
| `+__VSX__+` | BOOST_HW_SIMD_PPC_VSX_VERSION
|===
*/ // end::reference[]
#define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE
#undef BOOST_HW_SIMD_PPC
#if !defined(BOOST_HW_SIMD_PPC) && defined(__VECTOR4DOUBLE__)
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_QPX_VERSION
#endif
#if !defined(BOOST_HW_SIMD_PPC) && defined(__VSX__)
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VSX_VERSION
#endif
#if !defined(BOOST_HW_SIMD_PPC) && (defined(__ALTIVEC__) || defined(__VEC__))
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VMX_VERSION
#endif
#if !defined(BOOST_HW_SIMD_PPC)
# define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE
#else
# define BOOST_HW_SIMD_PPC_AVAILABLE
#endif
#define BOOST_HW_SIMD_PPC_NAME "PPC SIMD"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC, BOOST_HW_SIMD_PPC_NAME)

View File

@@ -0,0 +1,57 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H
#include <boost/predef/version_number.h>
/* tag::reference[]
= `BOOST_HW_SIMD_PPC_*_VERSION`
Those defines represent Power PC SIMD extensions versions.
NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`.
*/ // end::reference[]
// ---------------------------------
/* tag::reference[]
= `BOOST_HW_SIMD_PPC_VMX_VERSION`
The https://en.wikipedia.org/wiki/AltiVec#VMX128[VMX] powerpc extension
version number.
Version number is: *1.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_PPC_VSX_VERSION`
The https://en.wikipedia.org/wiki/AltiVec#VSX[VSX] powerpc extension version
number.
Version number is: *1.1.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_PPC_QPX_VERSION`
The QPX powerpc extension version number.
Version number is: *2.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0)
/* tag::reference[]
*/ // end::reference[]
#endif

View File

@@ -0,0 +1,125 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_H
#define BOOST_PREDEF_HARDWARE_SIMD_X86_H
#include <boost/predef/version_number.h>
#include <boost/predef/hardware/simd/x86/versions.h>
/* tag::reference[]
= `BOOST_HW_SIMD_X86`
The SIMD extension for x86 (*if detected*).
Version number depends on the most recent detected extension.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__SSE__+` | {predef_detection}
| `+_M_X64+` | {predef_detection}
| `_M_IX86_FP >= 1` | {predef_detection}
| `+__SSE2__+` | {predef_detection}
| `+_M_X64+` | {predef_detection}
| `_M_IX86_FP >= 2` | {predef_detection}
| `+__SSE3__+` | {predef_detection}
| `+__SSSE3__+` | {predef_detection}
| `+__SSE4_1__+` | {predef_detection}
| `+__SSE4_2__+` | {predef_detection}
| `+__AVX__+` | {predef_detection}
| `+__FMA__+` | {predef_detection}
| `+__AVX2__+` | {predef_detection}
|===
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__SSE__+` | BOOST_HW_SIMD_X86_SSE_VERSION
| `+_M_X64+` | BOOST_HW_SIMD_X86_SSE_VERSION
| `_M_IX86_FP >= 1` | BOOST_HW_SIMD_X86_SSE_VERSION
| `+__SSE2__+` | BOOST_HW_SIMD_X86_SSE2_VERSION
| `+_M_X64+` | BOOST_HW_SIMD_X86_SSE2_VERSION
| `_M_IX86_FP >= 2` | BOOST_HW_SIMD_X86_SSE2_VERSION
| `+__SSE3__+` | BOOST_HW_SIMD_X86_SSE3_VERSION
| `+__SSSE3__+` | BOOST_HW_SIMD_X86_SSSE3_VERSION
| `+__SSE4_1__+` | BOOST_HW_SIMD_X86_SSE4_1_VERSION
| `+__SSE4_2__+` | BOOST_HW_SIMD_X86_SSE4_2_VERSION
| `+__AVX__+` | BOOST_HW_SIMD_X86_AVX_VERSION
| `+__FMA__+` | BOOST_HW_SIMD_X86_FMA3_VERSION
| `+__AVX2__+` | BOOST_HW_SIMD_X86_AVX2_VERSION
|===
*/ // end::reference[]
#define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE
#undef BOOST_HW_SIMD_X86
#if !defined(BOOST_HW_SIMD_X86) && defined(__MIC__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MIC_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX2__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX2_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__FMA__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_FMA_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_2__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_2_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_1__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_1_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__SSSE3__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSSE3_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE3__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE3_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2))
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE2_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1))
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86) && defined(__MMX__)
# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MMX_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86)
# define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE
#else
# define BOOST_HW_SIMD_X86_AVAILABLE
#endif
#define BOOST_HW_SIMD_X86_NAME "x86 SIMD"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86, BOOST_HW_SIMD_X86_NAME)

View File

@@ -0,0 +1,135 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H
#define BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H
#include <boost/predef/version_number.h>
/* tag::reference[]
= `BOOST_HW_SIMD_X86_*_VERSION`
Those defines represent x86 SIMD extensions versions.
NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_X86`.
*/ // end::reference[]
// ---------------------------------
/* tag::reference[]
= `BOOST_HW_SIMD_X86_MMX_VERSION`
The https://en.wikipedia.org/wiki/MMX_(instruction_set)[MMX] x86 extension
version number.
Version number is: *0.99.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_MMX_VERSION BOOST_VERSION_NUMBER(0, 99, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSE_VERSION`
The https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions[SSE] x86 extension
version number.
Version number is: *1.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSE_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSE2_VERSION`
The https://en.wikipedia.org/wiki/SSE2[SSE2] x86 extension version number.
Version number is: *2.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSE2_VERSION BOOST_VERSION_NUMBER(2, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSE3_VERSION`
The https://en.wikipedia.org/wiki/SSE3[SSE3] x86 extension version number.
Version number is: *3.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSE3_VERSION BOOST_VERSION_NUMBER(3, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSSE3_VERSION`
The https://en.wikipedia.org/wiki/SSSE3[SSSE3] x86 extension version number.
Version number is: *3.1.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSSE3_VERSION BOOST_VERSION_NUMBER(3, 1, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSE4_1_VERSION`
The https://en.wikipedia.org/wiki/SSE4#SSE4.1[SSE4_1] x86 extension version
number.
Version number is: *4.1.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSE4_1_VERSION BOOST_VERSION_NUMBER(4, 1, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_SSE4_2_VERSION`
The https://en.wikipedia.org/wiki/SSE4##SSE4.2[SSE4_2] x86 extension version
number.
Version number is: *4.2.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_SSE4_2_VERSION BOOST_VERSION_NUMBER(4, 2, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AVX_VERSION`
The https://en.wikipedia.org/wiki/Advanced_Vector_Extensions[AVX] x86
extension version number.
Version number is: *5.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AVX_VERSION BOOST_VERSION_NUMBER(5, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_FMA3_VERSION`
The https://en.wikipedia.org/wiki/FMA_instruction_set[FMA3] x86 extension
version number.
Version number is: *5.2.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_FMA3_VERSION BOOST_VERSION_NUMBER(5, 2, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AVX2_VERSION`
The https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2[AVX2]
x86 extension version number.
Version number is: *5.3.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AVX2_VERSION BOOST_VERSION_NUMBER(5, 3, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_MIC_VERSION`
The https://en.wikipedia.org/wiki/Xeon_Phi[MIC] (Xeon Phi) x86 extension
version number.
Version number is: *9.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_MIC_VERSION BOOST_VERSION_NUMBER(9, 0, 0)
/* tag::reference[]
*/ // end::reference[]
#endif

View File

@@ -0,0 +1,89 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H
#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H
#include <boost/predef/version_number.h>
#include <boost/predef/hardware/simd/x86_amd/versions.h>
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AMD`
The SIMD extension for x86 (AMD) (*if detected*).
Version number depends on the most recent detected extension.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__SSE4A__+` | {predef_detection}
| `+__FMA4__+` | {predef_detection}
| `+__XOP__+` | {predef_detection}
| `BOOST_HW_SIMD_X86` | {predef_detection}
|===
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__SSE4A__+` | BOOST_HW_SIMD_X86_SSE4A_VERSION
| `+__FMA4__+` | BOOST_HW_SIMD_X86_FMA4_VERSION
| `+__XOP__+` | BOOST_HW_SIMD_X86_XOP_VERSION
| `BOOST_HW_SIMD_X86` | BOOST_HW_SIMD_X86
|===
NOTE: This predef includes every other x86 SIMD extensions and also has other
more specific extensions (FMA4, XOP, SSE4a). You should use this predef
instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have
been detected.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
// AMD CPUs also use x86 architecture. We first try to detect if any AMD
// specific extension are detected, if yes, then try to detect more recent x86
// common extensions.
#undef BOOST_HW_SIMD_X86_AMD
#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__XOP__)
# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_XOP_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__FMA4__)
# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_FMA4_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__SSE4A__)
# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION
#endif
#if !defined(BOOST_HW_SIMD_X86_AMD)
# define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
#else
// At this point, we know that we have an AMD CPU, we do need to check for
// other x86 extensions to determine the final version number.
# include <boost/predef/hardware/simd/x86.h>
# if BOOST_HW_SIMD_X86 > BOOST_HW_SIMD_X86_AMD
# undef BOOST_HW_SIMD_X86_AMD
# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86
# endif
# define BOOST_HW_SIMD_X86_AMD_AVAILABLE
#endif
#define BOOST_HW_SIMD_X86_AMD_NAME "x86 (AMD) SIMD"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME)

View File

@@ -0,0 +1,56 @@
/*
Copyright Charly Chevalier 2015
Copyright Joel Falcou 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H
#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H
#include <boost/predef/version_number.h>
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AMD_*_VERSION`
Those defines represent x86 (AMD specific) SIMD extensions versions.
NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_X86_AMD`.
*/ // end::reference[]
// ---------------------------------
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION`
https://en.wikipedia.org/wiki/SSE4##SSE4A[SSE4A] x86 extension (AMD specific).
Version number is: *4.0.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION BOOST_VERSION_NUMBER(4, 0, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AMD_FMA4_VERSION`
https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set[FMA4] x86 extension (AMD specific).
Version number is: *5.1.0*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AMD_FMA4_VERSION BOOST_VERSION_NUMBER(5, 1, 0)
/* tag::reference[]
= `BOOST_HW_SIMD_X86_AMD_XOP_VERSION`
https://en.wikipedia.org/wiki/XOP_instruction_set[XOP] x86 extension (AMD specific).
Version number is: *5.1.1*.
*/ // end::reference[]
#define BOOST_HW_SIMD_X86_AMD_XOP_VERSION BOOST_VERSION_NUMBER(5, 1, 1)
/* tag::reference[]
*/ // end::reference[]
#endif