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#include <boost/predef/hardware/simd/x86.h>
10#include <boost/predef/hardware/simd/x86_amd.h>
11#include <boost/predef/hardware/simd/arm.h>
12#include <boost/predef/hardware/simd/ppc.h>
13
14#ifndef BOOST_PREDEF_HARDWARE_SIMD_H
15#define BOOST_PREDEF_HARDWARE_SIMD_H
16
17#include <boost/predef/version_number.h>
18
19/*`
20 [section Using the `BOOST_HW_SIMD_*` predefs]
21 [include ../doc/hardware_simd.qbk]
22 [endsect]
23
24 [/ --------------------------- ]
25
26 [section `BOOST_HW_SIMD_*`]
27
28 [heading `BOOST_HW_SIMD`]
29
30 The SIMD extension detected for a specific architectures.
31 Version number depends on the detected extension.
32
33 [table
34 [[__predef_symbol__] [__predef_version__]]
35
36 [[`BOOST_HW_SIMD_X86_AVAILABLE`] [__predef_detection__]]
37 [[`BOOST_HW_SIMD_X86_AMD_AVAILABLE`] [__predef_detection__]]
38 [[`BOOST_HW_SIMD_ARM_AVAILABLE`] [__predef_detection__]]
39 [[`BOOST_HW_SIMD_PPC_AVAILABLE`] [__predef_detection__]]
40 ]
41
42 [include ../include/boost/predef/hardware/simd/x86.h]
43 [include ../include/boost/predef/hardware/simd/x86_amd.h]
44 [include ../include/boost/predef/hardware/simd/arm.h]
45 [include ../include/boost/predef/hardware/simd/ppc.h]
46
47 [endsect]
48
49 [/ --------------------------- ]
50
51 [section `BOOST_HW_SIMD_X86_*_VERSION`]
52 [include ../include/boost/predef/hardware/simd/x86/versions.h]
53 [endsect]
54
55 [section `BOOST_HW_SIMD_X86_AMD_*_VERSION`]
56 [include ../include/boost/predef/hardware/simd/x86_amd/versions.h]
57 [endsect]
58
59 [section `BOOST_HW_SIMD_ARM_*_VERSION`]
60 [include ../include/boost/predef/hardware/simd/arm/versions.h]
61 [endsect]
62
63 [section `BOOST_HW_SIMD_PPC_*_VERSION`]
64 [include ../include/boost/predef/hardware/simd/ppc/versions.h]
65 [endsect]
66
67 */
68
69// We check if SIMD extension of multiples architectures have been detected,
70// if yes, then this is an error!
71//
72// NOTE: _X86_AMD implies _X86, so there is no need to check for it here!
73//
74#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_PPC_AVAILABLE) ||\
75 defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) ||\
76 defined(BOOST_HW_SIMD_PPC_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE)
77# error "Multiple SIMD architectures detected, this cannot happen!"
78#endif
79
80#if defined(BOOST_HW_SIMD_X86_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE)
81 // If both standard _X86 and _X86_AMD are available,
82 // then take the biggest version of the two!
83# if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_AMD
84# define BOOST_HW_SIMD BOOST_HW_SIMD_X86
85# else
86# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD
87# endif
88#endif
89
90#if !defined(BOOST_HW_SIMD)
91 // At this point, only one of these two is defined
92# if defined(BOOST_HW_SIMD_X86_AVAILABLE)
93# define BOOST_HW_SIMD BOOST_HW_SIMD_X86
94# endif
95# if defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE)
96# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD
97# endif
98#endif
99
100#if defined(BOOST_HW_SIMD_ARM_AVAILABLE)
101# define BOOST_HW_SIMD BOOST_HW_SIMD_ARM
102#endif
103
104#if defined(BOOST_HW_SIMD_PPC_AVAILABLE)
105# define BOOST_HW_SIMD BOOST_HW_SIMD_PPC
106#endif
107
108#if defined(BOOST_HW_SIMD)
109# define BOOST_HW_SIMD_AVAILABLE
110#else
111# define BOOST_HW_SIMD BOOST_VERSION_NUMBER_NOT_AVAILABLE
112#endif
113
114#define BOOST_HW_SIMD_NAME "Hardware SIMD"
115
116#endif
117
118#include <boost/predef/detail/test.h>
119BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD, BOOST_HW_SIMD_NAME)
120