Refactor ARM SIMD detection + Add _VERSION(s) for ARM family

This commit is contained in:
Charly Chevalier
2015-07-20 11:03:05 +02:00
parent 4aa12a8965
commit 7399d0169d
3 changed files with 55 additions and 60 deletions

View File

@@ -6,37 +6,48 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// From the newest to the oldest
#include <boost/predef/hardware/simd/arm/neon.h>
#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>
/*`
[heading `BOOST_HW_SIMD_ARM`]
The SIMD extension for ARM (if detected).
Version number depends on the detected extension.
BOOST_HW_SIMD_ARM is defined by the first detected extension.
Version number depends on the most recent detected extension.
[table
[[__predef_symbol__] [__predef_version__]]
[[`BOOST_HW_SIMD_ARM`] [__predef_detection__]]
[[`BOOST_HW_SIMD_ARM`] [V.R.P]]
[[__predef_detection__] [__predef_detection__]]
[[`__aarch64__`] [__predef_detection__]]
[[`_M_ARM`] [__predef_detection__]]
[[`__ARM_NEON__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]]
[[`__aarch64__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]]
[[`_M_ARM`] [BOOST_HW_SIMD_ARM_NEON_VERSION]]
]
*/
#if defined(BOOST_HW_SIMD_ARM)
# define BOOST_HW_SIMD_ARM_AVAILABLE
#else
# define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE
# define BOOST_HW_SIMD_ARM_NAME "ARM SIMD"
#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))
# 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>

View File

@@ -1,47 +0,0 @@
/*
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_NEON_H
#define BOOST_PREDEF_HARDWARE_SIMD_ARM_NEON_H
#include <boost/predef/version_number.h>
/*`
[heading `BOOST_HW_SIMD_ARM_NEON`]
[@https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29 NEON] ARM extension.
Version number is: 1.0.0.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__ARM_NEON__`] [__predef_detection__]]
[[`__aarch64__`] [__predef_detection__]]
[[`_M_ARM`] [__predef_detection__]]
]
*/
#define BOOST_HW_SIMD_ARM_NEON BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM)
# undef BOOST_HW_SIMD_ARM_NEON
# define BOOST_HW_SIMD_ARM_NEON BOOST_VERSION_NUMBER(1, 0, 0)
# define BOOST_HW_SIMD_ARM_NEON_AVAILABLE
#endif
#define BOOST_HW_SIMD_ARM_NEON_NAME "ARM SIMD NEON"
#if !defined(BOOST_HW_SIMD_ARM) && defined(BOOST_HW_SIMD_ARM_NEON_AVAILABLE)
# define BOOST_HW_SIMD_ARM BOOST_HW_SIMD_ARM_NEON
# define BOOST_HW_SIMD_ARM_NAME BOOST_HW_SIMD_ARM_NEON_NAME
#endif
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_ARM_NEON, BOOST_HW_SIMD_ARM_NEON_NAME)

View File

@@ -0,0 +1,31 @@
/*
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>
/*`
[heading `BOOST_HW_SIMD_ARM_*_VERSION`]
[note Those defines represent ARM SIMD extensions versions. You can
compare them with the predef BOOST_HW_SIMD_ARM.]
*/
// ---------------------------------
/*`
[heading `BOOST_HW_SIMD_ARM_NEON`]
[@https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29 NEON] ARM extension.
Version number is: 1.0.0.
*/
#define BOOST_HW_SIMD_ARM_NEON_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
#endif