13 #ifndef L1Algo_F32vec4P4_H 14 #define L1Algo_F32vec4P4_H 18 #include "xmmintrin.h" 43 #define _f32vec4_abs_mask (static_cast<F32vec4>(__f32vec4_abs_mask_cheat.m)) 44 #define _f32vec4_sgn_mask (static_cast<F32vec4>(__f32vec4_sgn_mask_cheat.m)) 45 #define _f32vec4_zero (static_cast<F32vec4>(__f32vec4_zero_cheat.m)) 46 #define _f32vec4_one (static_cast<F32vec4>(__f32vec4_one_cheat.m)) 47 #define _f32vec4_true (static_cast<F32vec4>(__f32vec4_true_cheat.m)) 48 #define _f32vec4_false (static_cast<F32vec4>(__f32vec4_false_cheat.m)) 54 float &
operator[](
int i) {
return (reinterpret_cast<float *>(&v))[
i]; }
55 float operator[](
int i)
const {
return (reinterpret_cast<const float *>(&v))[
i]; }
59 F32vec4(
const float &a) : v(_mm_set_ps1(a)) {}
61 F32vec4(
const float &f0,
const float &f1,
const float &f2,
const float &f3) : v(_mm_set_ps(f3, f2, f1, f0)) {}
64 operator __m128()
const {
return v; }
91 return _mm_sub_ps(_mm_add_ps(Ra0, Ra0), _mm_mul_ps(_mm_mul_ps(Ra0, a), Ra0));
105 return _mm_and_ps(a, b);
109 return _mm_or_ps(a, b);
113 return _mm_xor_ps(a, b);
127 return _mm_cmplt_ps(a, b);
131 return _mm_cmple_ps(a, b);
135 return _mm_cmpgt_ps(a, b);
139 return _mm_cmpge_ps(a, b);
143 return _mm_cmpeq_ps(a, b);
146 #define if3(a, b, c) ((a) & (b)) | ((!(a)) & (c)) // analog (a) ? b : c 148 #define NotEmpty(a) bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3]) 149 #define Empty(a) !(bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3])) 163 #define _f1(A, F) F32vec4(F(A[0]), F(A[1]), F(A[2]), F(A[3])) 193 b = (pi_2 & gt_tan_3pi_8) + (
F32vec4(!gt_tan_3pi_8) & b);
194 b = (pi_4 & gt_tan_pi_8) + (
F32vec4(!gt_tan_pi_8) & b);
195 a = (gt_tan_3pi_8 & (minusOne / a)) + (
F32vec4(!gt_tan_3pi_8) & a);
196 a = (gt_tan_pi_8 & ((absY - absX) / (absY + absX))) + (
F32vec4(!gt_tan_pi_8) & a);
198 b += (((8.05374449538e-2 * a2 - 1.38776856032E-1) * a2 + 1.99777106478E-1) * a2 - 3.33329491539E-1) * a2 * a + a;
200 b = (xyNeg & (-b)) + (
F32vec4(!xyNeg) & b);
202 b = (xyNeg & (b +
pi)) + (
F32vec4(!xyNeg) & b);
204 b = (xyNeg & (b -
pi)) + (
F32vec4(!xyNeg) & b);
205 xyNeg =
F32vec4(xZero & yZero);
206 b = (xyNeg & zero) + (
F32vec4(!xyNeg) & b);
208 b = (xyNeg & (-pi_2)) + (
F32vec4(!xyNeg) & b);
214 strm <<
"[" << a[0] <<
" " << a[1] <<
" " << a[2] <<
" " << a[3] <<
"]";
233 #define _fvecalignment __attribute__((aligned(16)))
const union @48 __f32vec4_true_cheat
friend F32vec4 operator!(const F32vec4 &a)
friend F32vec4 log(const F32vec4 &a)
const union @48 __f32vec4_false_cheat
friend F32vec4 operator==(const F32vec4 &a, const F32vec4 &b)
const union @48 __f32vec4_one_cheat
const union @48 __f32vec4_zero_cheat
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 rsqrt(const F32vec4 &a)
friend F32vec4 acos(const F32vec4 &a)
friend std::ostream & operator<<(std::ostream &strm, const F32vec4 &a)
vec_arithmetic(F32vec4, float)
friend F32vec4 operator>(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 operator+(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 exp(const F32vec4 &a)
friend F32vec4 rcp(const F32vec4 &a)
#define _f32vec4_sgn_mask
friend F32vec4 operator/(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 asgnb(const F32vec4 &a, const F32vec4 &b)
#define _f32vec4_abs_mask
friend F32vec4 operator|(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 if3(const F32vec4 &a, const F32vec4 &b, const F32vec4 &c)
const union @48 __f32vec4_sgn_mask_cheat
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
friend F32vec4 operator<(const F32vec4 &a, const F32vec4 &b)
float operator[](int i) const
friend F32vec4 bool2int(const F32vec4 &a)
friend F32vec4 cos(const F32vec4 &a)
friend F32vec4 operator<=(const F32vec4 &a, const F32vec4 &b)
float & operator[](int i)
class F32vec4 __attribute__((aligned(16)))
friend F32vec4 operator &(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 operator^(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 fabs(const F32vec4 &a)
const union @48 __f32vec4_abs_mask_cheat
friend F32vec4 operator-(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 sgn(const F32vec4 &a)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 operator>=(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 sqrt(const F32vec4 &a)
friend std::istream & operator>>(std::istream &strm, F32vec4 &a)
friend F32vec4 operator*(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 sin(const F32vec4 &a)