include/simd.h
branchpyrit
changeset 95 ca7d4c665531
parent 94 4c8abb8977dc
child 98 64638385798a
equal deleted inserted replaced
94:4c8abb8977dc 95:ca7d4c665531
    32 
    32 
    33 #ifndef NO_SIMD
    33 #ifndef NO_SIMD
    34 
    34 
    35 #include <xmmintrin.h>
    35 #include <xmmintrin.h>
    36 
    36 
    37 typedef __m128 mfloat4;
    37 #define mfloat4 __m128
    38 
    38 
    39 #define mZero  _mm_set_ps1(0.0f)
    39 #define mZero  _mm_setzero_ps()
    40 #define mOne   _mm_set_ps1(1.0f)
    40 #define mOne   _mm_set_ps1(1.0f)
    41 #define mTwo   _mm_set_ps1(2.0f)
    41 #define mTwo   _mm_set_ps1(2.0f)
    42 #define mEps   _mm_set_ps1(Eps)
    42 #define mEps   _mm_set_ps1(Eps)
    43 #define mMEps  _mm_set_ps1(-Eps)
    43 #define mMEps  _mm_set_ps1(-Eps)
    44 #define mInf   _mm_set_ps1(Inf)
    44 #define mInf   _mm_set_ps1(Inf)
    64 #define mcmpneq _mm_cmpneq_ps
    64 #define mcmpneq _mm_cmpneq_ps
    65 #define mmin _mm_min_ps
    65 #define mmin _mm_min_ps
    66 #define mmax _mm_max_ps
    66 #define mmax _mm_max_ps
    67 #define mmovemask _mm_movemask_ps
    67 #define mmovemask _mm_movemask_ps
    68 
    68 
       
    69 #define mShuffle0 _MM_SHUFFLE(0,0,0,0)
       
    70 #define mShuffle1 _MM_SHUFFLE(1,1,1,1)
       
    71 #define mShuffle2 _MM_SHUFFLE(2,2,2,2)
       
    72 #define mShuffle3 _MM_SHUFFLE(3,3,3,3)
       
    73 #define mshuffle _mm_shuffle_ps
       
    74 
    69 inline const mfloat4 mselect(const mfloat4& mask, const mfloat4& a, const mfloat4& b)
    75 inline const mfloat4 mselect(const mfloat4& mask, const mfloat4& a, const mfloat4& b)
    70 {
    76 {
    71 	return _mm_or_ps(_mm_and_ps(mask, a), _mm_andnot_ps(mask, b));
    77 	return _mm_or_ps(_mm_and_ps(mask, a), _mm_andnot_ps(mask, b));
    72 }
    78 }
    73 
    79