Go to the documentation of this file. 1 #ifndef L1Algo_F64vec2P4_H
2 #define L1Algo_F64vec2P4_H
34 #define _f64vec2_abs_mask (static_cast<F64vec2>(__f64vec2_abs_mask_cheat.m))
35 #define _f64vec2_sgn_mask (static_cast<F64vec2>(__f64vec2_sgn_mask_cheat.m))
36 #define _f64vec2_zero (static_cast<F64vec2>(__f64vec2_zero_cheat.m))
37 #define _f64vec2_one (static_cast<F64vec2>(__f64vec2_one_cheat.m))
38 #define _f64vec2_true (static_cast<F64vec2>(__f64vec2_true_cheat.m))
39 #define _f64vec2_false (static_cast<F64vec2>(__f64vec2_false_cheat.m))
45 double&
operator[](
int i) {
return (
reinterpret_cast<double*
>(&
v))[
i]; }
47 return (
reinterpret_cast<const double*
>(&
v))[
i];
52 F64vec2(
const double& a) :
v(_mm_set_pd1(a)) {}
54 F64vec2(
const double& f0,
const double& f1) :
v(_mm_set_pd(f1, f0)) {}
57 operator __m128d()
const {
return v; }
61 return _mm_add_pd(a, b);
64 return _mm_sub_pd(a, b);
67 return _mm_mul_pd(a, b);
70 return _mm_div_pd(a, b);
75 return _mm_min_pd(a, b);
78 return _mm_max_pd(a, b);
113 return _mm_and_pd(a, b);
117 return _mm_or_pd(a, b);
121 return _mm_xor_pd(a, b);
134 return _mm_cmplt_pd(a, b);
138 return _mm_cmple_pd(a, b);
142 return _mm_cmpgt_pd(a, b);
146 return _mm_cmpge_pd(a, b);
150 return _mm_cmpeq_pd(a, b);
153 #define if3(a, b, c) ((a) & (b)) | ((!(a)) & (c)) // analog (a) ? b : c
155 #define NotEmpty(a) bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3])
156 #define Empty(a) !(bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3]))
169 #define _f1(A, F) F64vec2(F(A[0]), F(A[1]))
180 const F64vec2 pi(3.1415926535897932);
199 b = (pi_2 & gt_tan_3pi_8) + (
F64vec2(!gt_tan_3pi_8) & b);
200 b = (pi_4 & gt_tan_pi_8) + (
F64vec2(!gt_tan_pi_8) & b);
201 a = (gt_tan_3pi_8 & (minusOne / a)) + (
F64vec2(!gt_tan_3pi_8) & a);
202 a = (gt_tan_pi_8 & ((absY - absX) / (absY + absX)))
206 (((8.05374449538e-2 * a2 - 1.38776856032E-1) * a2 + 1.99777106478E-1) * a2
211 b = (xyNeg & (-b)) + (
F64vec2(!xyNeg) & b);
213 b = (xyNeg & (b + pi)) + (
F64vec2(!xyNeg) & b);
215 b = (xyNeg & (b - pi)) + (
F64vec2(!xyNeg) & b);
216 xyNeg =
F64vec2(xZero & yZero);
217 b = (xyNeg & zero) + (
F64vec2(!xyNeg) & b);
219 b = (xyNeg & (-pi_2)) + (
F64vec2(!xyNeg) & b);
224 strm <<
"[" << a[0] <<
" " << a[1] <<
" " << a[2] <<
" " << a[3] <<
"]";
243 #define _fvecalignment __attribute__((aligned(16)))
friend F64vec2 exp(const F64vec2 &a)
friend F64vec2 operator+(const F64vec2 &a, const F64vec2 &b)
class F64vec2 __attribute__((aligned(16)))
friend F64vec2 atan2(const F64vec2 &y, const F64vec2 &x)
double operator[](int i) const
friend F64vec2 operator|(const F64vec2 &a, const F64vec2 &b)
#define _f64vec2_sgn_mask
friend F64vec2 sqrt(const F64vec2 &a)
friend F64vec2 asgnb(const F64vec2 &a, const F64vec2 &b)
const union @14 __f64vec2_abs_mask_cheat
friend F64vec2 operator>(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 operator/(const F64vec2 &a, const F64vec2 &b)
friend std::ostream & operator<<(std::ostream &strm, const F64vec2 &a)
friend F64vec2 operator^(const F64vec2 &a, const F64vec2 &b)
const union @14 __f64vec2_sgn_mask_cheat
friend F64vec2 operator==(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 operator<(const F64vec2 &a, const F64vec2 &b)
F64vec2(const double &f0, const double &f1)
friend F64vec2 fabs(const F64vec2 &a)
friend F64vec2 rsqrt(const F64vec2 &a)
friend F64vec2 log(const F64vec2 &a)
const union @14 __f64vec2_zero_cheat
const union @14 __f64vec2_true_cheat
#define _f64vec2_abs_mask
friend F64vec2 operator!(const F64vec2 &a)
friend std::istream & operator>>(std::istream &strm, F64vec2 &a)
friend F64vec2 rcp(const F64vec2 &a)
friend F64vec2 operator&(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 acos(const F64vec2 &a)
const union @14 __f64vec2_one_cheat
friend F64vec2 cos(const F64vec2 &a)
friend F64vec2 sgn(const F64vec2 &a)
friend F64vec2 operator>=(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 sin(const F64vec2 &a)
const union @14 __f64vec2_false_cheat
friend F64vec2 operator<=(const F64vec2 &a, const F64vec2 &b)
double & operator[](int i)
friend F64vec2 max(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 operator-(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 min(const F64vec2 &a, const F64vec2 &b)
friend F64vec2 bool2int(const F64vec2 &a)
vec_arithmetic(F64vec2, double)
friend F64vec2 operator*(const F64vec2 &a, const F64vec2 &b)