Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 09:11:40

0001 /***************************************************************************
0002  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0003  * Martin Renou                                                             *
0004  * Copyright (c) QuantStack                                                 *
0005  * Copyright (c) Serge Guelton                                              *
0006  *                                                                          *
0007  * Distributed under the terms of the BSD 3-Clause License.                 *
0008  *                                                                          *
0009  * The full license is in the file LICENSE, distributed with this software. *
0010  ****************************************************************************/
0011 
0012 #ifndef XSIMD_REGISTER_HPP
0013 #define XSIMD_REGISTER_HPP
0014 
0015 #include <type_traits>
0016 
0017 namespace xsimd
0018 {
0019     namespace types
0020     {
0021         template <class T, class A>
0022         struct has_simd_register : std::false_type
0023         {
0024         };
0025 
0026         template <class T, class Arch>
0027         struct simd_register
0028         {
0029             struct register_type
0030             {
0031             };
0032         };
0033 
0034 #define XSIMD_DECLARE_SIMD_REGISTER(SCALAR_TYPE, ISA, VECTOR_TYPE) \
0035     template <>                                                    \
0036     struct simd_register<SCALAR_TYPE, ISA>                         \
0037     {                                                              \
0038         using register_type = VECTOR_TYPE;                         \
0039         register_type data;                                        \
0040         XSIMD_INLINE operator register_type() const noexcept       \
0041         {                                                          \
0042             return data;                                           \
0043         }                                                          \
0044     };                                                             \
0045     template <>                                                    \
0046     struct has_simd_register<SCALAR_TYPE, ISA> : std::true_type    \
0047     {                                                              \
0048     }
0049 
0050 #define XSIMD_DECLARE_INVALID_SIMD_REGISTER(SCALAR_TYPE, ISA)    \
0051     template <>                                                  \
0052     struct has_simd_register<SCALAR_TYPE, ISA> : std::false_type \
0053     {                                                            \
0054     }
0055 
0056 #define XSIMD_DECLARE_SIMD_REGISTER_ALIAS(ISA, ISA_BASE)                          \
0057     template <class T>                                                            \
0058     struct simd_register<T, ISA> : simd_register<T, ISA_BASE>                     \
0059     {                                                                             \
0060         using register_type = typename simd_register<T, ISA_BASE>::register_type; \
0061         simd_register(register_type reg) noexcept                                 \
0062             : simd_register<T, ISA_BASE> { reg }                                  \
0063         {                                                                         \
0064         }                                                                         \
0065         simd_register() = default;                                                \
0066     };                                                                            \
0067     template <class T>                                                            \
0068     struct has_simd_register<T, ISA> : has_simd_register<T, ISA_BASE>             \
0069     {                                                                             \
0070     }
0071 
0072         template <class T, class Arch>
0073         struct get_bool_simd_register
0074         {
0075             using type = simd_register<T, Arch>;
0076         };
0077 
0078         template <class T, class Arch>
0079         using get_bool_simd_register_t = typename get_bool_simd_register<T, Arch>::type;
0080     }
0081 
0082     namespace kernel
0083     {
0084         template <class A>
0085         // makes requires_arch equal to A const&, using type_traits functions
0086         using requires_arch = typename std::add_lvalue_reference<typename std::add_const<A>::type>::type;
0087         template <class T>
0088         struct convert
0089         {
0090         };
0091     }
0092 }
0093 
0094 #endif