39 const __m128i exponentPart = _mm_and_si128(_mm_castpd_si128(v.
data()), exponentBits);
40 *e = _mm_sub_epi32(_mm_srli_epi64(exponentPart, 52), _mm_set1_epi32(0x3fe));
41 const __m128d exponentMaximized = _mm_or_pd(v.
data(), _mm_castsi128_pd(exponentBits));
42 double_v ret = _mm_and_pd(exponentMaximized, _mm_load_pd(reinterpret_cast<const double *>(&c_general::frexpMask[0])));
50 const __m128i exponentPart = _mm_and_si128(_mm_castps_si128(v.
data()), exponentBits);
51 *e = _mm_sub_epi32(_mm_srli_epi32(exponentPart, 23), _mm_set1_epi32(0x7e));
52 const __m128 exponentMaximized = _mm_or_ps(v.
data(), _mm_castsi128_ps(exponentBits));
53 float_v ret = _mm_and_ps(exponentMaximized, _mm_castsi128_ps(_mm_set1_epi32(0xbf7fffffu)));
60 const __m128i exponentPart0 = _mm_and_si128(_mm_castps_si128(v.
data()[0]), exponentBits);
61 const __m128i exponentPart1 = _mm_and_si128(_mm_castps_si128(v.
data()[1]), exponentBits);
62 *e = _mm_sub_epi16(_mm_packs_epi32(_mm_srli_epi32(exponentPart0, 23), _mm_srli_epi32(exponentPart1, 23)),
63 _mm_set1_epi16(0x7e));
64 const __m128 exponentMaximized0 = _mm_or_ps(v.
data()[0], _mm_castsi128_ps(exponentBits));
65 const __m128 exponentMaximized1 = _mm_or_ps(v.
data()[1], _mm_castsi128_ps(exponentBits));
67 _mm_and_ps(exponentMaximized0, _mm_castsi128_ps(_mm_set1_epi32(0xbf7fffffu))),
68 _mm_and_ps(exponentMaximized1, _mm_castsi128_ps(_mm_set1_epi32(0xbf7fffffu)))
72 e->
setZero(static_cast<short_m>(zeroMask));
83 const __m128i exponentBits = _mm_slli_epi64(e.
data(), 52);
84 return _mm_castsi128_pd(_mm_add_epi64(_mm_castpd_si128(v.
data()), exponentBits));
89 return (v.reinterpretCast<
int_v>() + (e << 23)).reinterpretCast<
float_v>();
95 const __m128i exponentBits0 = _mm_unpacklo_epi16(_mm_setzero_si128(), e.data());
96 const __m128i exponentBits1 = _mm_unpackhi_epi16(_mm_setzero_si128(), e.data());
97 return M256::create(_mm_castsi128_ps(_mm_add_epi32(_mm_castps_si128(v.data()[0]), exponentBits0)),
98 _mm_castsi128_ps(_mm_add_epi32(_mm_castps_si128(v.data()[1]), exponentBits1)));
101 #ifdef VC_IMPL_SSE4_1
105 _mm_round_ps(v.data()[1], 0x3)); }
110 _mm_floor_ps(v.data()[1])); }
115 _mm_ceil_ps(v.data()[1])); }
121 x >>=
static_cast<int_v>(e);
130 x >>= _mm_cvttps_epi32(e.
data()[0]);
131 y >>= _mm_cvttps_epi32(e.
data()[1]);
132 v.
data()[0] = _mm_and_ps(v.
data()[0], _mm_castsi128_ps(x.
data()));
133 v.
data()[1] = _mm_and_ps(v.
data()[1], _mm_castsi128_ps(y.data()));
138 const long long initialMask = 0xfff0000000000000ull;
144 d_ll mask0 = { initialMask >> shifts[0] };
145 d_ll mask1 = { initialMask >> shifts[1] };
146 v &=
double_v(_mm_setr_pd(mask0.d, mask1.d));
152 typedef typename V::Mask M;
155 V e =
abs(v).exponent();
156 const M negativeExponent = e < 0;
157 e.setZero(negativeExponent);
162 v.setZero(negativeExponent);
170 typedef typename V::Mask M;
173 V e =
abs(v).exponent();
174 const M negativeExponent = e < 0;
175 e.setZero(negativeExponent);
176 const M negativeInput = v <
V::Zero();
180 v.setZero(negativeExponent);
181 v(negativeInput && _v != v) -=
V::One();
188 typedef typename V::Mask M;
191 V e =
abs(v).exponent();
192 const M negativeExponent = e < 0;
193 e.setZero(negativeExponent);
194 const M positiveInput = v >
V::Zero();
198 v.setZero(negativeExponent);
199 v(positiveInput && _v != v) +=
V::One();
209 #define VC__USE_NAMESPACE SSE
210 #include "../common/trigonometric.h"
211 #define VC__USE_NAMESPACE SSE
212 #include "../common/logarithm.h"
213 #define VC__USE_NAMESPACE SSE
214 #include "../common/exponential.h"
215 #undef VC__USE_NAMESPACE
217 #endif // VC_SSE_MATH_H
static void floor_shift(float_v &v, float_v::AsArg e)
Vector< T > floor(VC_ALIGNED_PARAMETER(Vector< T >) _v)
double_v ldexp(double_v::AsArg v, int_v::AsArg _e)
Vc_INTRINSIC_L void setZero() Vc_INTRINSIC_R
static Vc_ALWAYS_INLINE Vc_PURE Vector< T >::Mask isnan(const Vector< T > &x)
Vc_ALWAYS_INLINE Vc_PURE _M128 data() const
static Vc_INTRINSIC Vc_CONST M256 create(_M128 a, _M128 b)
Vector< T > ceil(VC_ALIGNED_PARAMETER(Vector< T >) _v)
static Vc_INTRINSIC_L Vector Zero() Vc_INTRINSIC_R
static Vc_ALWAYS_INLINE Vc_PURE Vector< T > abs(const Vector< T > &x)
static Vc_INTRINSIC __m128i Vc_CONST _mm_setallone_si128()
double_v frexp(const double_v &v, int_v *e)
splits v into exponent and mantissa, the sign is kept with the mantissa
Vc_ALWAYS_INLINE Vc_PURE V2 reinterpretCast() const
#define VC_ALIGNED_PARAMETER(_Type)
VECTOR_NAMESPACE::int_v int_v
Vector< double > double_v
static Vc_ALWAYS_INLINE Vc_CONST M exponentMask()
Vector< float8 > sfloat_v
VECTOR_NAMESPACE::float_v float_v
Vector< T > trunc(VC_ALIGNED_PARAMETER(Vector< T >) _v)
Vc_ALWAYS_INLINE Vc_PURE _M128I dataI() const
static Vc_ALWAYS_INLINE Vc_PURE Vector< T >::Mask isfinite(const Vector< T > &x)
Vc_ALWAYS_INLINE Vc_PURE VectorType & data()