OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkNx_sse_DEFINED | 8 #ifndef SkNx_sse_DEFINED |
9 #define SkNx_sse_DEFINED | 9 #define SkNx_sse_DEFINED |
10 | 10 |
11 // This file may assume <= SSE2, but must check SK_CPU_SSE_LEVEL for anything mo
re recent. | 11 // This file may assume <= SSE2, but must check SK_CPU_SSE_LEVEL for anything mo
re recent. |
12 | 12 |
| 13 namespace { // See SkNx.h |
| 14 |
| 15 |
13 template <> | 16 template <> |
14 class SkNf<2, float> { | 17 class SkNf<2, float> { |
15 public: | 18 public: |
16 SkNf(const __m128& vec) : fVec(vec) {} | 19 SkNf(const __m128& vec) : fVec(vec) {} |
17 | 20 |
18 SkNf() {} | 21 SkNf() {} |
19 explicit SkNf(float val) : fVec(_mm_set1_ps(val)) {} | 22 explicit SkNf(float val) : fVec(_mm_set1_ps(val)) {} |
20 static SkNf Load(const float vals[2]) { | 23 static SkNf Load(const float vals[2]) { |
21 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals)); | 24 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals)); |
22 } | 25 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 306 } |
304 | 307 |
305 SkNi thenElse(const SkNi& t, const SkNi& e) const { | 308 SkNi thenElse(const SkNi& t, const SkNi& e) const { |
306 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec), | 309 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec), |
307 _mm_andnot_si128(fVec, e.fVec)); | 310 _mm_andnot_si128(fVec, e.fVec)); |
308 } | 311 } |
309 | 312 |
310 __m128i fVec; | 313 __m128i fVec; |
311 }; | 314 }; |
312 | 315 |
| 316 } // namespace |
| 317 |
313 #endif//SkNx_sse_DEFINED | 318 #endif//SkNx_sse_DEFINED |
OLD | NEW |