Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:25:46

0001 /*  This file is part of the Vc library. {{{
0002 Copyright © 2009-2015 Matthias Kretz <kretz@kde.org>
0003 
0004 Redistribution and use in source and binary forms, with or without
0005 modification, are permitted provided that the following conditions are met:
0006     * Redistributions of source code must retain the above copyright
0007       notice, this list of conditions and the following disclaimer.
0008     * Redistributions in binary form must reproduce the above copyright
0009       notice, this list of conditions and the following disclaimer in the
0010       documentation and/or other materials provided with the distribution.
0011     * Neither the names of contributing organizations nor the
0012       names of its contributors may be used to endorse or promote products
0013       derived from this software without specific prior written permission.
0014 
0015 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
0016 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0018 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
0019 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
0020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0021 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0022 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0023 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0024 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0025 
0026 }}}*/
0027 
0028 #ifndef VC_VECTOR_H_
0029 #define VC_VECTOR_H_
0030 
0031 // 1. define all of Vc::Scalar - this one is always present, so it makes sense to put it first
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  * \name Vector Type Aliases
0045  * \ingroup Vectors
0046  */
0047 ///@{
0048 /**\addtogroup Vectors
0049  * @{
0050  */
0051 /// vector of double precision
0052 using double_v = Vector<double>;
0053 /// vector of single precision
0054 using float_v = Vector<float>;
0055 /// vector of signed integers
0056 using int_v = Vector<int>;
0057 /// vector of unsigned integers
0058 using uint_v = Vector<uint>;
0059 /// vector of signed short integers
0060 using short_v = Vector<short>;
0061 /// vector of unsigned short integers
0062 using ushort_v = Vector<ushort>;
0063 ///\internal vector of signed long long integers
0064 using llong_v = Vector<llong>;
0065 ///\internal vector of unsigned long long integers
0066 using ullong_v = Vector<ullong>;
0067 ///\internal vector of signed long integers
0068 using long_v = Vector<long>;
0069 ///\internal vector of unsigned long integers
0070 using ulong_v = Vector<ulong>;
0071 ///\internal vector of signed char-sized integers
0072 using schar_v = Vector<schar>;
0073 ///\internal vector of unsigned char-sized integers
0074 using uchar_v = Vector<uchar>;
0075 ///@}
0076 ///@}
0077 
0078 /**
0079  * \name Mask Type Aliases
0080  * \ingroup Masks
0081  */
0082 ///@{
0083 /**\addtogroup Masks
0084  * @{
0085  */
0086 /// mask type for double_v vectors
0087 using double_m = Mask<double>;
0088 /// mask type for float_v vectors
0089 using  float_m = Mask< float>;
0090 ///\internal mask type for llong_v vectors
0091 using  llong_m = Mask< llong>;
0092 ///\internal mask type for ullong_v vectors
0093 using ullong_m = Mask<ullong>;
0094 ///\internal mask type for long_v vectors
0095 using   long_m = Mask<  long>;
0096 ///\internal mask type for ulong_v vectors
0097 using  ulong_m = Mask< ulong>;
0098 /// mask type for int_v vectors
0099 using    int_m = Mask<   int>;
0100 /// mask type for uint_v vectors
0101 using   uint_m = Mask<  uint>;
0102 /// mask type for short_v vectors
0103 using  short_m = Mask< short>;
0104 /// mask type for ushort_v vectors
0105 using ushort_m = Mask<ushort>;
0106 ///\internal mask type for schar_v vectors
0107 using  schar_m = Mask< schar>;
0108 ///\internal mask type for uchar_v vectors
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 // finally define the non-member operators
0186 #include "common/operators.h"
0187 
0188 #include "common/simdarray.h"
0189 // XXX See bottom of common/simdmaskarray.h:
0190 //#include "common/simd_cast_caller.tcc"
0191 
0192 #include "common/alignedbase.h"
0193 namespace Vc_VERSIONED_NAMESPACE {
0194 /**
0195  * \ingroup Vectors
0196  *
0197  * Specifies the most conservative memory alignment necessary for Vector<T> objects with
0198  * default VectorAbi. Use this value e.g. with an \c alignas expression or when allocating
0199  * aligned memory dynamically (\ref Vc::malloc).
0200  *
0201  * \see Vc::MemoryAlignment
0202  * \see Vc::VectorAlignedBase
0203  */
0204 constexpr std::size_t VectorAlignment = alignof(VectorAlignedBase);
0205 /**
0206  * \ingroup Vectors
0207  *
0208  * Specifies the most conservative memory alignment necessary for aligned loads and stores
0209  * of Vector types. Use this value e.g. with an \c alignas expression or when allocating
0210  * aligned memory dynamically (\ref Vc::malloc).
0211  *
0212  * \see Vc::VectorAlignment
0213  * \see Vc::Vector<T, Abi>::MemoryAlignment
0214  */
0215 constexpr std::size_t MemoryAlignment = alignof(MemoryAlignedBase);
0216 } // namespace Vc_VERSIONED_NAMESPACE
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 } // namespace std
0275 #endif
0276 
0277 Vc_RESET_DIAGNOSTICS
0278 
0279 #endif // VC_VECTOR_H_