File indexing completed on 2026-11-07 10:37:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef XSIMD_VSX_REGISTER_HPP
0013 #define XSIMD_VSX_REGISTER_HPP
0014
0015 #include "./xsimd_common_arch.hpp"
0016 #include "./xsimd_register.hpp"
0017
0018 #if XSIMD_WITH_VSX
0019 #include <altivec.h>
0020 #endif
0021
0022 namespace xsimd
0023 {
0024
0025
0026
0027
0028
0029 struct vsx : common
0030 {
0031 static constexpr bool supported() noexcept { return XSIMD_WITH_VSX; }
0032 static constexpr bool available() noexcept { return true; }
0033 static constexpr bool requires_alignment() noexcept { return true; }
0034 static constexpr std::size_t alignment() noexcept { return 16; }
0035 static constexpr char const* name() noexcept { return "vmx+vsx"; }
0036 };
0037
0038 #if XSIMD_WITH_VSX
0039 namespace types
0040 {
0041
0042 #define XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(T, Tv, Tb) \
0043 template <> \
0044 struct get_bool_simd_register<T, vsx> \
0045 { \
0046 struct type \
0047 { \
0048 using register_type = __vector __bool Tb; \
0049 register_type data; \
0050 type() = default; \
0051 type(register_type r) \
0052 : data(r) \
0053 { \
0054 } \
0055 operator register_type() const noexcept { return data; } \
0056 }; \
0057 }; \
0058 XSIMD_DECLARE_SIMD_REGISTER(T, vsx, __vector Tv)
0059
0060
0061
0062
0063 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(signed char, signed char, char);
0064 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(unsigned char, unsigned char, char);
0065 #ifdef __CHAR_UNSIGNED__
0066 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(char, unsigned char, char);
0067 #else
0068 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(char, signed char, char);
0069 #endif
0070 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(unsigned short, unsigned short, short);
0071 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(short, short, short);
0072 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(unsigned int, unsigned int, int);
0073 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(int, int, int);
0074 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(unsigned long, unsigned long long, long long);
0075 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(long, long long, long long);
0076 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(float, float, int);
0077 XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER(double, double, long long);
0078
0079 #undef XSIMD_DECLARE_SIMD_BOOL_VSX_REGISTER
0080 }
0081 #endif
0082 }
0083
0084 #endif