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

This commit is contained in:
Charly Chevalier
2015-07-20 11:04:06 +02:00
parent 7399d0169d
commit 9a0d1235eb
5 changed files with 83 additions and 153 deletions

View File

@@ -6,11 +6,6 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt) http://www.boost.org/LICENSE_1_0.txt)
*/ */
// From the newest to the oldest
#include <boost/predef/hardware/simd/ppc/qpx.h>
#include <boost/predef/hardware/simd/ppc/vsx.h>
#include <boost/predef/hardware/simd/ppc/vmx.h>
#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_H #ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_H #define BOOST_PREDEF_HARDWARE_SIMD_PPC_H
@@ -19,26 +14,50 @@ http://www.boost.org/LICENSE_1_0.txt)
/*` /*`
[heading `BOOST_HW_SIMD_PPC`] [heading `BOOST_HW_SIMD_PPC`]
The SIMD extension for x86 (if detected). The SIMD extension for PowerPC (if detected).
Version number depends on the detected extension. Version number depends on the most recent detected extension.
BOOST_HW_SIMD_PPC is defined by the first detected extension. They are
checked from the newest to the oldest. (QPX -> VSX -> VMX)
[table [table
[[__predef_symbol__] [__predef_version__]] [[__predef_symbol__] [__predef_version__]]
[[`BOOST_HW_SIMD_PPC`] [__predef_detection__]]
[[`BOOST_HW_SIMD_PPC`] [V.R.P]] [[`__VECTOR4DOUBLE__`] [__predef_detection__]]
[[`__ALTIVEC__`] [__predef_detection__]]
[[`__VEC__`] [__predef_detection__]]
[[`__VSX__`] [__predef_detection__]]
[[`__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]]
] ]
*/ */
#if defined(BOOST_HW_SIMD_PPC) #define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE
# define BOOST_HW_SIMD_PPC_AVAILABLE
#else #undef BOOST_HW_SIMD_PPC
# define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE #if !defined(BOOST_HW_SIMD_PPC) && defined(__VECTOR4DOUBLE__)
# define BOOST_HW_SIMD_PPC_NAME "PowerPC SIMD" # define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_QPX_VERSION
#endif #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 #endif

View File

@@ -1,45 +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_PPC_QPX_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_QPX_H
#include <boost/predef/version_number.h>
/*`
[heading `BOOST_HW_SIMD_PPC_QPX`]
QPX powerpc extension.
Version number is: 2.0.0.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__VECTOR4DOUBLE__`] [__predef_detection__]]
]
*/
#define BOOST_HW_SIMD_PPC_QPX BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__VECTOR4DOUBLE__)
# undef BOOST_HW_SIMD_PPC_QPX
# define BOOST_HW_SIMD_PPC_QPX BOOST_VERSION_NUMBER(2, 0, 0)
# define BOOST_HW_SIMD_PPC_QPX_AVAILABLE
#endif
#define BOOST_HW_SIMD_PPC_QPX_NAME "PowerPC SIMD QPX"
#if !defined(BOOST_HW_SIMD_PPC) && defined(BOOST_HW_SIMD_PPC_QPX_AVAILABLE)
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_QPX
# define BOOST_HW_SIMD_PPC_NAME BOOST_HW_SIMD_PPC_QPX_NAME
#endif
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC_QPX, BOOST_HW_SIMD_PPC_QPX_NAME)

View File

@@ -0,0 +1,47 @@
/*
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>
/*`
[heading `BOOST_HW_SIMD_PPC_*_VERSION`]
[note Those defines represent Power PC SIMD extensions versions. You can
compare them with the predef BOOST_HW_SIMD_PPC.]
*/
// ---------------------------------
/*`
[heading `BOOST_HW_SIMD_PPC_VMX`]
[@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension.
Version number is: 1.0.0.
*/
#define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
/*`
[heading `BOOST_HW_SIMD_PPC_VSX`]
[@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension.
Version number is: 1.1.0.
*/
#define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0)
/*`
[heading `BOOST_HW_SIMD_PPC_QPX`]
QPX powerpc extension.
Version number is: 2.0.0.
*/
#define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0)
#endif

View File

@@ -1,46 +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_PPC_VMX_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VMX_H
#include <boost/predef/version_number.h>
/*`
[heading `BOOST_HW_SIMD_PPC_VMX`]
[@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension.
Version number is: 1.0.0.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__ALTIVEC__`] [__predef_detection__]]
[[`__VEC__`] [__predef_detection__]]
]
*/
#define BOOST_HW_SIMD_PPC_VMX BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__ALTIVEC__) || defined(__VEC__)
# undef BOOST_HW_SIMD_PPC_VMX
# define BOOST_HW_SIMD_PPC_VMX BOOST_VERSION_NUMBER(1, 0, 0)
# define BOOST_HW_SIMD_PPC_VMX_AVAILABLE
#endif
#define BOOST_HW_SIMD_PPC_VMX_NAME "PowerPC SIMD VMX"
#if !defined(BOOST_HW_SIMD_PPC) && defined(BOOST_HW_SIMD_PPC_VMX_AVAILABLE)
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VMX
# define BOOST_HW_SIMD_PPC_NAME BOOST_HW_SIMD_PPC_VMX_NAME
#endif
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC_VMX, BOOST_HW_SIMD_PPC_VMX_NAME)

View File

@@ -1,45 +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_PPC_VSX_H
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VSX_H
#include <boost/predef/version_number.h>
/*`
[heading `BOOST_HW_SIMD_PPC_VSX`]
[@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension.
Version number is: 1.1.0.
[table
[[__predef_symbol__] [__predef_version__]]
[[`__VSX__`] [__predef_detection__]]
]
*/
#define BOOST_HW_SIMD_PPC_VSX BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__VSX__)
# undef BOOST_HW_SIMD_PPC_VSX
# define BOOST_HW_SIMD_PPC_VSX BOOST_VERSION_NUMBER(1, 1, 0)
# define BOOST_HW_SIMD_PPC_VSX_AVAILABLE
#endif
#define BOOST_HW_SIMD_PPC_VSX_NAME "PowerPC SIMD VSX"
#if !defined(BOOST_HW_SIMD_PPC) && defined(BOOST_HW_SIMD_PPC_VSX_AVAILABLE)
# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VSX
# define BOOST_HW_SIMD_PPC_NAME BOOST_HW_SIMD_PPC_VSX_NAME
#endif
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC_VSX, BOOST_HW_SIMD_PPC_VSX_NAME)