OLD | NEW |
1 // It is important _not_ to put header guards here. | 1 // It is important _not_ to put header guards here. |
2 // This file will be intentionally included three times. | 2 // This file will be intentionally included three times. |
3 | 3 |
4 // Useful reading: | 4 // Useful reading: |
5 // https://software.intel.com/sites/landingpage/IntrinsicsGuide/ | 5 // https://software.intel.com/sites/landingpage/IntrinsicsGuide/ |
6 | 6 |
7 #include "SkTypes.h" // Keep this before any #ifdef for skbug.com/3362 | 7 #include "SkTypes.h" // Keep this before any #ifdef for skbug.com/3362 |
8 | 8 |
9 #if defined(SK4X_PREAMBLE) | 9 #if defined(SK4X_PREAMBLE) |
10 // Code in this file may assume SSE and SSE2. | 10 // Code in this file may assume SSE and SSE2. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 template <typename T> Sk4x<T>::Sk4x(const Sk4x& other) { *this = other; } | 55 template <typename T> Sk4x<T>::Sk4x(const Sk4x& other) { *this = other; } |
56 template <typename T> Sk4x<T>& Sk4x<T>::operator=(const Sk4x<T>& other) { | 56 template <typename T> Sk4x<T>& Sk4x<T>::operator=(const Sk4x<T>& other) { |
57 fVec = other.fVec; | 57 fVec = other.fVec; |
58 return *this; | 58 return *this; |
59 } | 59 } |
60 | 60 |
61 // We pun in these _mm_shuffle_* methods a little to use the fastest / most avai
lable methods. | 61 // We pun in these _mm_shuffle_* methods a little to use the fastest / most avai
lable methods. |
62 // They're all bit-preserving operations so it shouldn't matter. | 62 // They're all bit-preserving operations so it shouldn't matter. |
63 | 63 |
64 template <typename T> | 64 template <typename T> |
| 65 Sk4x<T> Sk4x<T>::aacc() const { return _mm_shuffle_epi32(as_4i(fVec), _MM_SHUFFL
E(2,2,0,0)); } |
| 66 template <typename T> |
| 67 Sk4x<T> Sk4x<T>::bbdd() const { return _mm_shuffle_epi32(as_4i(fVec), _MM_SHUFFL
E(3,3,1,1)); } |
| 68 template <typename T> |
65 Sk4x<T> Sk4x<T>::badc() const { return _mm_shuffle_epi32(as_4i(fVec), _MM_SHUFFL
E(2,3,0,1)); } | 69 Sk4x<T> Sk4x<T>::badc() const { return _mm_shuffle_epi32(as_4i(fVec), _MM_SHUFFL
E(2,3,0,1)); } |
66 | 70 |
67 // Now we'll write all Sk4f specific methods. This M() macro will remove some n
oise. | 71 // Now we'll write all Sk4f specific methods. This M() macro will remove some n
oise. |
68 #define M(...) template <> inline __VA_ARGS__ Sk4f:: | 72 #define M(...) template <> inline __VA_ARGS__ Sk4f:: |
69 | 73 |
70 M() Sk4x(float v) : fVec(_mm_set1_ps(v)) {} | 74 M() Sk4x(float v) : fVec(_mm_set1_ps(v)) {} |
71 M() Sk4x(float a, float b, float c, float d) : fVec(_mm_set_ps(d,c,b,a)) {} | 75 M() Sk4x(float a, float b, float c, float d) : fVec(_mm_set_ps(d,c,b,a)) {} |
72 | 76 |
73 M(Sk4f) Load (const float fs[4]) { return _mm_loadu_ps(fs); } | 77 M(Sk4f) Load (const float fs[4]) { return _mm_loadu_ps(fs); } |
74 M(Sk4f) LoadAligned(const float fs[4]) { return _mm_load_ps (fs); } | 78 M(Sk4f) LoadAligned(const float fs[4]) { return _mm_load_ps (fs); } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 168 } |
165 M(Sk4i) Max(const Sk4i& a, const Sk4i& b) { | 169 M(Sk4i) Max(const Sk4i& a, const Sk4i& b) { |
166 Sk4i less = a.lessThan(b); | 170 Sk4i less = a.lessThan(b); |
167 return b.bitAnd(less).bitOr(a.andNot(less)); | 171 return b.bitAnd(less).bitOr(a.andNot(less)); |
168 } | 172 } |
169 #endif | 173 #endif |
170 | 174 |
171 #undef M | 175 #undef M |
172 | 176 |
173 #endif//Method definitions. | 177 #endif//Method definitions. |
OLD | NEW |