Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:37:18

0001 /***************************************************************************
0002  * Copyright (c) Andreas Krebbel                                            *
0003  * Based on xsimd_vsx_register.hpp                                          *
0004  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0005  * Martin Renou                                                             *
0006  * Copyright (c) QuantStack                                                 *
0007  * Copyright (c) Serge Guelton                                              *
0008  *                                                                          *
0009  * Distributed under the terms of the BSD 3-Clause License.                 *
0010  *                                                                          *
0011  * The full license is in the file LICENSE, distributed with this software. *
0012  ****************************************************************************/
0013 
0014 #ifndef XSIMD_VXE_REGISTER_HPP
0015 #define XSIMD_VXE_REGISTER_HPP
0016 
0017 #include "./xsimd_common_arch.hpp"
0018 #include "./xsimd_register.hpp"
0019 
0020 #if XSIMD_WITH_VXE
0021 #include <vecintrin.h>
0022 #endif
0023 
0024 namespace xsimd
0025 {
0026     /**
0027      * @ingroup architectures
0028      *
0029      * VXE instructions
0030      */
0031     struct vxe : common
0032     {
0033         static constexpr bool supported() noexcept { return XSIMD_WITH_VXE; }
0034         static constexpr bool available() noexcept { return true; }
0035         static constexpr bool requires_alignment() noexcept { return true; }
0036         static constexpr std::size_t alignment() noexcept { return 16; }
0037         static constexpr char const* name() noexcept { return "vxe"; }
0038     };
0039 
0040 #if XSIMD_WITH_VXE
0041     namespace types
0042     {
0043 
0044 #define XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(T, Tv, Tb)              \
0045     template <>                                                      \
0046     struct get_bool_simd_register<T, vxe>                            \
0047     {                                                                \
0048         struct type                                                  \
0049         {                                                            \
0050             using register_type = __vector __bool Tb;                \
0051             register_type data;                                      \
0052             type() = default;                                        \
0053             type(register_type r)                                    \
0054                 : data(r)                                            \
0055             {                                                        \
0056             }                                                        \
0057             operator register_type() const noexcept { return data; } \
0058         };                                                           \
0059     };                                                               \
0060     XSIMD_DECLARE_SIMD_REGISTER(T, vxe, __vector Tv)
0061 
0062         // The VXE vector intrinsics do not support long, unsigned long,
0063         // and char data types.  batches of these types are vectors of
0064         // equivalent types.
0065         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(signed char, signed char, char);
0066         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(unsigned char, unsigned char, char);
0067 #ifdef __CHAR_UNSIGNED__
0068         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(char, unsigned char, char);
0069 #else
0070         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(char, signed char, char);
0071 #endif
0072         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(unsigned short, unsigned short, short);
0073         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(short, short, short);
0074         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(unsigned int, unsigned int, int);
0075         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(int, int, int);
0076         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(unsigned long, unsigned long long, long long);
0077         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(long, long long, long long);
0078         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(float, float, int);
0079         XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER(double, double, long long);
0080 
0081 #undef XSIMD_DECLARE_SIMD_BOOL_VXE_REGISTER
0082     }
0083 #endif
0084 }
0085 
0086 #endif