MessagePack for C
Loading...
Searching...
No Matches
simd.h
Go to the documentation of this file.
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
13
14#ifndef MSGPACK_PREDEF_HARDWARE_SIMD_H
15#define MSGPACK_PREDEF_HARDWARE_SIMD_H
16
18
19/*`
20 [section Using the `MSGPACK_HW_SIMD_*` predefs]
21 [include ../doc/hardware_simd.qbk]
22 [endsect]
23
24 [/ --------------------------- ]
25
26 [section `MSGPACK_HW_SIMD_*`]
27
28 [heading `MSGPACK_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 [[`MSGPACK_HW_SIMD_X86_AVAILABLE`] [__predef_detection__]]
37 [[`MSGPACK_HW_SIMD_X86_AMD_AVAILABLE`] [__predef_detection__]]
38 [[`MSGPACK_HW_SIMD_ARM_AVAILABLE`] [__predef_detection__]]
39 [[`MSGPACK_HW_SIMD_PPC_AVAILABLE`] [__predef_detection__]]
40 ]
41
42 [include ../include/msgpack/predef/hardware/simd/x86.h]
43 [include ../include/msgpack/predef/hardware/simd/x86_amd.h]
44 [include ../include/msgpack/predef/hardware/simd/arm.h]
45 [include ../include/msgpack/predef/hardware/simd/ppc.h]
46
47 [endsect]
48
49 [/ --------------------------- ]
50
51 [section `MSGPACK_HW_SIMD_X86_*_VERSION`]
52 [include ../include/msgpack/predef/hardware/simd/x86/versions.h]
53 [endsect]
54
55 [section `MSGPACK_HW_SIMD_X86_AMD_*_VERSION`]
56 [include ../include/msgpack/predef/hardware/simd/x86_amd/versions.h]
57 [endsect]
58
59 [section `MSGPACK_HW_SIMD_ARM_*_VERSION`]
60 [include ../include/msgpack/predef/hardware/simd/arm/versions.h]
61 [endsect]
62
63 [section `MSGPACK_HW_SIMD_PPC_*_VERSION`]
64 [include ../include/msgpack/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(MSGPACK_HW_SIMD_ARM_AVAILABLE) && defined(MSGPACK_HW_SIMD_PPC_AVAILABLE) ||\
75 defined(MSGPACK_HW_SIMD_ARM_AVAILABLE) && defined(MSGPACK_HW_SIMD_X86_AVAILABLE) ||\
76 defined(MSGPACK_HW_SIMD_PPC_AVAILABLE) && defined(MSGPACK_HW_SIMD_X86_AVAILABLE)
77# error "Multiple SIMD architectures detected, this cannot happen!"
78#endif
79
80#if defined(MSGPACK_HW_SIMD_X86_AVAILABLE) && defined(MSGPACK_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 MSGPACK_HW_SIMD_X86 >= MSGPACK_HW_SIMD_X86_AMD
84# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_X86
85# else
86# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_X86_AMD
87# endif
88#endif
89
90#if !defined(MSGPACK_HW_SIMD)
91 // At this point, only one of these two is defined
92# if defined(MSGPACK_HW_SIMD_X86_AVAILABLE)
93# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_X86
94# endif
95# if defined(MSGPACK_HW_SIMD_X86_AMD_AVAILABLE)
96# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_X86_AMD
97# endif
98#endif
99
100#if defined(MSGPACK_HW_SIMD_ARM_AVAILABLE)
101# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_ARM
102#endif
103
104#if defined(MSGPACK_HW_SIMD_PPC_AVAILABLE)
105# define MSGPACK_HW_SIMD MSGPACK_HW_SIMD_PPC
106#endif
107
108#if defined(MSGPACK_HW_SIMD)
109# define MSGPACK_HW_SIMD_AVAILABLE
110#else
111# define MSGPACK_HW_SIMD MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
112#endif
113
114#define MSGPACK_HW_SIMD_NAME "Hardware SIMD"
115
116#endif
117
#define MSGPACK_HW_SIMD
Definition simd.h:111
#define MSGPACK_HW_SIMD_NAME
Definition simd.h:114
#define MSGPACK_PREDEF_DECLARE_TEST(x, s)
Definition test.h:13