1 #ifndef L1Algo_F32vec4P4_H
2 #define L1Algo_F32vec4P4_H
37 #define _f32vec4_abs_mask (static_cast<F32vec4>(__f32vec4_abs_mask_cheat.m))
38 #define _f32vec4_sgn_mask (static_cast<F32vec4>(__f32vec4_sgn_mask_cheat.m))
39 #define _f32vec4_zero (static_cast<F32vec4>(__f32vec4_zero_cheat.m))
40 #define _f32vec4_one (static_cast<F32vec4>(__f32vec4_one_cheat.m))
41 #define _f32vec4_true (static_cast<F32vec4>(__f32vec4_true_cheat.m))
42 #define _f32vec4_false (static_cast<F32vec4>(__f32vec4_false_cheat.m))
50 float &
operator[](
int i ){
return (reinterpret_cast<float*>(&
v))[
i]; }
51 float operator[](
int i )
const {
return (reinterpret_cast<const float*>(&
v))[
i]; }
57 F32vec4(
const float &f0,
const float &
f1,
const float &
f2,
const float &
f3 ):
v(_mm_set_ps(f3,f2,f1,f0)) {}
60 operator __m128()
const {
return v; }
86 return _mm_sub_ps(_mm_add_ps(Ra0, Ra0), _mm_mul_ps(_mm_mul_ps(Ra0, a), Ra0));
102 return _mm_and_ps(a, b);
105 return _mm_or_ps(a, b);
108 return _mm_xor_ps(a, b);
120 return _mm_cmplt_ps(a, b);
123 return _mm_cmple_ps(a, b);
126 return _mm_cmpgt_ps(a, b);
129 return _mm_cmpge_ps(a, b);
132 return _mm_cmpeq_ps(a, b);
135 #define if3(a, b, c) ((a)&(b)) | ((!(a))&(c)) // analog (a) ? b : c
137 #define NotEmpty(a) bool((a)[0])|bool((a)[1])|bool((a)[2])|bool((a)[3])
138 #define Empty(a) !(bool((a)[0])|bool((a)[1])|bool((a)[2])|bool((a)[3]))
151 #define _f1(A,F) F32vec4( F(A[0]), F(A[1]), F(A[2]), F(A[3]) )
180 b = (pi_2 & gt_tan_3pi_8) + (
F32vec4(!gt_tan_3pi_8) &
b);
181 b = (pi_4 & gt_tan_pi_8) + (
F32vec4(!gt_tan_pi_8) &
b);
182 a = (gt_tan_3pi_8 & (minusOne /
a)) + (
F32vec4(!gt_tan_3pi_8) &
a);
183 a = (gt_tan_pi_8 & ((absY - absX) / (absY + absX))) + (
F32vec4(!gt_tan_pi_8) &
a) ;
185 b += (((8.05374449538e-2 * a2
186 - 1.38776856032E-1) * a2
187 + 1.99777106478E-1) * a2
188 - 3.33329491539E-1) * a2 * a
196 xyNeg =
F32vec4(xZero & yZero);
197 b = (xyNeg & zero) + (
F32vec4(!xyNeg) &
b);
199 b = (xyNeg & (-pi_2)) + (
F32vec4(!xyNeg) &
b);
204 strm<<
"["<<a[0]<<
" "<<a[1]<<
" "<<a[2]<<
" "<<a[3]<<
"]";
223 #define _fvecalignment __attribute__ ((aligned(16)))
union @50 __f32vec4_true_cheat
friend F32vec4 operator!(const F32vec4 &a)
friend F32vec4 log(const F32vec4 &a)
friend F32vec4 operator==(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 rsqrt(const F32vec4 &a)
union @50 __f32vec4_abs_mask_cheat
friend F32vec4 operator&(const F32vec4 &a, const F32vec4 &b)
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)
union @50 __f32vec4_sgn_mask_cheat
union @50 __f32vec4_false_cheat
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)
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
friend F32vec4 operator<(const F32vec4 &a, const F32vec4 &b)
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)
friend F32vec4 operator^(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 fabs(const F32vec4 &a)
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)
union @50 __f32vec4_zero_cheat
friend std::istream & operator>>(std::istream &strm, F32vec4 &a)
union @50 __f32vec4_one_cheat
friend F32vec4 operator*(const F32vec4 &a, const F32vec4 &b)
friend F32vec4 sin(const F32vec4 &a)