File indexing completed on 2025-01-31 10:25:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifndef VC_VECTOR_H_
0029 #define VC_VECTOR_H_
0030
0031
0032 #include "scalar/vector.h"
0033
0034 #if defined(Vc_IMPL_SSE)
0035 # include "sse/vector.h"
0036 #endif
0037 #ifdef Vc_IMPL_AVX
0038 # include "avx/vector.h"
0039 #endif
0040
0041 namespace Vc_VERSIONED_NAMESPACE
0042 {
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 using double_v = Vector<double>;
0053
0054 using float_v = Vector<float>;
0055
0056 using int_v = Vector<int>;
0057
0058 using uint_v = Vector<uint>;
0059
0060 using short_v = Vector<short>;
0061
0062 using ushort_v = Vector<ushort>;
0063
0064 using llong_v = Vector<llong>;
0065
0066 using ullong_v = Vector<ullong>;
0067
0068 using long_v = Vector<long>;
0069
0070 using ulong_v = Vector<ulong>;
0071
0072 using schar_v = Vector<schar>;
0073
0074 using uchar_v = Vector<uchar>;
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 using double_m = Mask<double>;
0088
0089 using float_m = Mask< float>;
0090
0091 using llong_m = Mask< llong>;
0092
0093 using ullong_m = Mask<ullong>;
0094
0095 using long_m = Mask< long>;
0096
0097 using ulong_m = Mask< ulong>;
0098
0099 using int_m = Mask< int>;
0100
0101 using uint_m = Mask< uint>;
0102
0103 using short_m = Mask< short>;
0104
0105 using ushort_m = Mask<ushort>;
0106
0107 using schar_m = Mask< schar>;
0108
0109 using uchar_m = Mask< uchar>;
0110
0111
0112
0113 typedef Vector<std:: int_least64_t> int_least64_v;
0114 typedef Vector<std::uint_least64_t> uint_least64_v;
0115 typedef Vector<std:: int_least32_t> int_least32_v;
0116 typedef Vector<std::uint_least32_t> uint_least32_v;
0117 typedef Vector<std:: int_least16_t> int_least16_v;
0118 typedef Vector<std::uint_least16_t> uint_least16_v;
0119 typedef Vector<std:: int_least8_t> int_least8_v;
0120 typedef Vector<std:: uint_least8_t> uint_least8_v;
0121
0122 typedef Mask<std:: int_least64_t> int_least64_m;
0123 typedef Mask<std::uint_least64_t> uint_least64_m;
0124 typedef Mask<std:: int_least32_t> int_least32_m;
0125 typedef Mask<std::uint_least32_t> uint_least32_m;
0126 typedef Mask<std:: int_least16_t> int_least16_m;
0127 typedef Mask<std::uint_least16_t> uint_least16_m;
0128 typedef Mask<std:: int_least8_t> int_least8_m;
0129 typedef Mask<std:: uint_least8_t> uint_least8_m;
0130
0131 typedef Vector<std:: int_fast64_t> int_fast64_v;
0132 typedef Vector<std::uint_fast64_t> uint_fast64_v;
0133 typedef Vector<std:: int_fast32_t> int_fast32_v;
0134 typedef Vector<std::uint_fast32_t> uint_fast32_v;
0135 typedef Vector<std:: int_fast16_t> int_fast16_v;
0136 typedef Vector<std::uint_fast16_t> uint_fast16_v;
0137 typedef Vector<std:: int_fast8_t> int_fast8_v;
0138 typedef Vector<std:: uint_fast8_t> uint_fast8_v;
0139
0140 typedef Mask<std:: int_fast64_t> int_fast64_m;
0141 typedef Mask<std::uint_fast64_t> uint_fast64_m;
0142 typedef Mask<std:: int_fast32_t> int_fast32_m;
0143 typedef Mask<std::uint_fast32_t> uint_fast32_m;
0144 typedef Mask<std:: int_fast16_t> int_fast16_m;
0145 typedef Mask<std::uint_fast16_t> uint_fast16_m;
0146 typedef Mask<std:: int_fast8_t> int_fast8_m;
0147 typedef Mask<std:: uint_fast8_t> uint_fast8_m;
0148
0149 #if defined INT64_MAX && defined UINT64_MAX
0150 typedef Vector<std:: int64_t> int64_v;
0151 typedef Vector<std::uint64_t> uint64_v;
0152 typedef Mask<std:: int64_t> int64_m;
0153 typedef Mask<std::uint64_t> uint64_m;
0154 #endif
0155 #if defined INT32_MAX && defined UINT32_MAX
0156 typedef Vector<std:: int32_t> int32_v;
0157 typedef Vector<std::uint32_t> uint32_v;
0158 typedef Mask<std:: int32_t> int32_m;
0159 typedef Mask<std::uint32_t> uint32_m;
0160 #endif
0161 #if defined INT16_MAX && defined UINT16_MAX
0162 typedef Vector<std:: int16_t> int16_v;
0163 typedef Vector<std::uint16_t> uint16_v;
0164 typedef Mask<std:: int16_t> int16_m;
0165 typedef Mask<std::uint16_t> uint16_m;
0166 #endif
0167 #if defined INT8_MAX && defined UINT8_MAX
0168 typedef Vector<std:: int8_t> int8_v;
0169 typedef Vector<std::uint8_t> uint8_v;
0170 typedef Mask<std:: int8_t> int8_m;
0171 typedef Mask<std::uint8_t> uint8_m;
0172 #endif
0173
0174 namespace {
0175 static_assert(double_v::Size == Vc_DOUBLE_V_SIZE, "Vc_DOUBLE_V_SIZE macro defined to an incorrect value");
0176 static_assert(float_v::Size == Vc_FLOAT_V_SIZE , "Vc_FLOAT_V_SIZE macro defined to an incorrect value ");
0177 static_assert(int_v::Size == Vc_INT_V_SIZE , "Vc_INT_V_SIZE macro defined to an incorrect value ");
0178 static_assert(uint_v::Size == Vc_UINT_V_SIZE , "Vc_UINT_V_SIZE macro defined to an incorrect value ");
0179 static_assert(short_v::Size == Vc_SHORT_V_SIZE , "Vc_SHORT_V_SIZE macro defined to an incorrect value ");
0180 static_assert(ushort_v::Size == Vc_USHORT_V_SIZE, "Vc_USHORT_V_SIZE macro defined to an incorrect value");
0181 }
0182 }
0183
0184
0185
0186 #include "common/operators.h"
0187
0188 #include "common/simdarray.h"
0189
0190
0191
0192 #include "common/alignedbase.h"
0193 namespace Vc_VERSIONED_NAMESPACE {
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204 constexpr std::size_t VectorAlignment = alignof(VectorAlignedBase);
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215 constexpr std::size_t MemoryAlignment = alignof(MemoryAlignedBase);
0216 }
0217
0218 #define Vc_VECTOR_DECLARED_ 1
0219
0220 #include "scalar/helperimpl.h"
0221 #include "scalar/math.h"
0222 #include "scalar/simd_cast_caller.tcc"
0223 #if defined(Vc_IMPL_SSE)
0224 # include "sse/helperimpl.h"
0225 # include "sse/math.h"
0226 # include "sse/simd_cast_caller.tcc"
0227 #endif
0228 #if defined(Vc_IMPL_AVX)
0229 # include "avx/helperimpl.h"
0230 # include "avx/math.h"
0231 # include "avx/simd_cast_caller.tcc"
0232 #endif
0233
0234 #include "common/math.h"
0235
0236 #ifdef isfinite
0237 #undef isfinite
0238 #endif
0239 #ifdef isnan
0240 #undef isnan
0241 #endif
0242
0243 #include "common/vectortuple.h"
0244 #include "common/where.h"
0245 #include "common/iif.h"
0246
0247 #ifndef Vc_NO_STD_FUNCTIONS
0248 namespace std
0249 {
0250 using Vc::min;
0251 using Vc::max;
0252
0253 using Vc::abs;
0254 using Vc::asin;
0255 using Vc::atan;
0256 using Vc::atan2;
0257 using Vc::ceil;
0258 using Vc::cos;
0259 using Vc::exp;
0260 using Vc::fma;
0261 using Vc::trunc;
0262 using Vc::floor;
0263 using Vc::frexp;
0264 using Vc::ldexp;
0265 using Vc::log;
0266 using Vc::log10;
0267 using Vc::log2;
0268 using Vc::round;
0269 using Vc::sin;
0270 using Vc::sqrt;
0271
0272 using Vc::isfinite;
0273 using Vc::isnan;
0274 }
0275 #endif
0276
0277 Vc_RESET_DIAGNOSTICS
0278
0279 #endif