| 1 | /* Copyright (C) 2013 Povilas Kanapickas <povilas@radix.lt> |
| 2 | |
| 3 | Distributed under the Boost Software License, Version 1.0. |
| 4 | (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | http://www.boost.org/LICENSE_1_0.txt) |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | // This file is generated automatically. See tools/gen_dispatcher_macros.py |
| 10 | |
| 11 | #ifndef LIBSIMDPP_DISPATCH_MACROS_GENERATED_H |
| 12 | #define LIBSIMDPP_DISPATCH_MACROS_GENERATED_H |
| 13 | |
| 14 | #include <simdpp/dispatch/collect_macros_generated.h> |
| 15 | #include <simdpp/dispatch/make_dispatcher.h> |
| 16 | |
| 17 | /** Note: the following macros are deprecated and provided only for backwards |
| 18 | compatibility. See SIMDPP_MAKE_DISPATCHER for a more versatile replacement. |
| 19 | |
| 20 | Builds a dispatcher for a specific non-member function. Different macros |
| 21 | are provided for functions with or without return value and for each |
| 22 | parameter count. |
| 23 | |
| 24 | Macros in the form @a SIMDPP_MAKE_DISPATCHER_VOID# are to be used for |
| 25 | functions with no return value. It accepts the following macro parameters: |
| 26 | |
| 27 | * NAME: the unqualified name of the function to dispatch. |
| 28 | |
| 29 | * T1, T2, ..., T#: the types of the parameters of the function that is |
| 30 | dispatched. |
| 31 | |
| 32 | Macros in the form @a SIMDPP_MAKE_DISPATCHER_RET# are to be used for |
| 33 | functions that return a value. It accepts the following macro parameters: |
| 34 | |
| 35 | * NAME: the unqualified name of the function to dispatch. |
| 36 | |
| 37 | * R: the type of the return value |
| 38 | |
| 39 | * T1, T2, ..., T#: the types of the parameters of the function that is |
| 40 | dispatcher. |
| 41 | |
| 42 | |
| 43 | @c SIMDPP_ARCH_NAMESPACE::NAME must refer to the function to be disptached |
| 44 | relative to the namespace in which the @a MAKE_DISPATCHER* macro is used in. |
| 45 | That is, the macro must be used in a namespace one level up than the |
| 46 | dispatched function, and that namespace must be @c SIMDPP_ARCH_NAMESPACE |
| 47 | |
| 48 | @a R, T1, T2, ..., T# must be exactly the same as those of the function |
| 49 | to be dispatched. The dispatched function may be overloaded. |
| 50 | |
| 51 | The macro defines a function with the same signature as the dispatched |
| 52 | function in the namespace the macro is used. The body of that function |
| 53 | implements the dispatch mechanism. |
| 54 | |
| 55 | The dispatch functions check the enabled instruction set and select the |
| 56 | best function on first call. The initialization does not introduce race |
| 57 | conditions when done concurrently. |
| 58 | */ |
| 59 | |
| 60 | |
| 61 | #define SIMDPP_MAKE_DISPATCHER_VOID0(NAME) \ |
| 62 | SIMDPP_MAKE_DISPATCHER((void)(NAME)()) |
| 63 | |
| 64 | #define SIMDPP_MAKE_DISPATCHER_VOID1(NAME,T1) \ |
| 65 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1)) |
| 66 | |
| 67 | #define SIMDPP_MAKE_DISPATCHER_VOID2(NAME,T1,T2) \ |
| 68 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2)) |
| 69 | |
| 70 | #define SIMDPP_MAKE_DISPATCHER_VOID3(NAME,T1,T2,T3) \ |
| 71 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3)) |
| 72 | |
| 73 | #define SIMDPP_MAKE_DISPATCHER_VOID4(NAME,T1,T2,T3,T4) \ |
| 74 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4)) |
| 75 | |
| 76 | #define SIMDPP_MAKE_DISPATCHER_VOID5(NAME,T1,T2,T3,T4,T5) \ |
| 77 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5)) |
| 78 | |
| 79 | #define SIMDPP_MAKE_DISPATCHER_VOID6(NAME,T1,T2,T3,T4,T5,T6) \ |
| 80 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6)) |
| 81 | |
| 82 | #define SIMDPP_MAKE_DISPATCHER_VOID7(NAME,T1,T2,T3,T4,T5,T6,T7) \ |
| 83 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7)) |
| 84 | |
| 85 | #define SIMDPP_MAKE_DISPATCHER_VOID8(NAME,T1,T2,T3,T4,T5,T6,T7,T8) \ |
| 86 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7,(T8) a8)) |
| 87 | |
| 88 | #define SIMDPP_MAKE_DISPATCHER_VOID9(NAME,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ |
| 89 | SIMDPP_MAKE_DISPATCHER((void)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7,(T8) a8,(T9) a9)) |
| 90 | |
| 91 | #define SIMDPP_MAKE_DISPATCHER_RET0(NAME,R) \ |
| 92 | SIMDPP_MAKE_DISPATCHER((R)(NAME)()) |
| 93 | |
| 94 | #define SIMDPP_MAKE_DISPATCHER_RET1(NAME,R,T1) \ |
| 95 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1)) |
| 96 | |
| 97 | #define SIMDPP_MAKE_DISPATCHER_RET2(NAME,R,T1,T2) \ |
| 98 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2)) |
| 99 | |
| 100 | #define SIMDPP_MAKE_DISPATCHER_RET3(NAME,R,T1,T2,T3) \ |
| 101 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3)) |
| 102 | |
| 103 | #define SIMDPP_MAKE_DISPATCHER_RET4(NAME,R,T1,T2,T3,T4) \ |
| 104 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4)) |
| 105 | |
| 106 | #define SIMDPP_MAKE_DISPATCHER_RET5(NAME,R,T1,T2,T3,T4,T5) \ |
| 107 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5)) |
| 108 | |
| 109 | #define SIMDPP_MAKE_DISPATCHER_RET6(NAME,R,T1,T2,T3,T4,T5,T6) \ |
| 110 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6)) |
| 111 | |
| 112 | #define SIMDPP_MAKE_DISPATCHER_RET7(NAME,R,T1,T2,T3,T4,T5,T6,T7) \ |
| 113 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7)) |
| 114 | |
| 115 | #define SIMDPP_MAKE_DISPATCHER_RET8(NAME,R,T1,T2,T3,T4,T5,T6,T7,T8) \ |
| 116 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7,(T8) a8)) |
| 117 | |
| 118 | #define SIMDPP_MAKE_DISPATCHER_RET9(NAME,R,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ |
| 119 | SIMDPP_MAKE_DISPATCHER((R)(NAME)((T1) a1,(T2) a2,(T3) a3,(T4) a4,(T5) a5,(T6) a6,(T7) a7,(T8) a8,(T9) a9)) |
| 120 | |
| 121 | |
| 122 | #endif |
| 123 | |
| 124 | |