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 | |
16 template <> | 13 template <> |
17 class SkNf<2, float> { | 14 class SkNf<2, float> { |
18 public: | 15 public: |
19 SkNf(const __m128& vec) : fVec(vec) {} | 16 SkNf(const __m128& vec) : fVec(vec) {} |
20 | 17 |
21 SkNf() {} | 18 SkNf() {} |
22 explicit SkNf(float val) : fVec(_mm_set1_ps(val)) {} | 19 explicit SkNf(float val) : fVec(_mm_set1_ps(val)) {} |
23 static SkNf Load(const float vals[2]) { | 20 static SkNf Load(const float vals[2]) { |
24 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals)); | 21 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals)); |
25 } | 22 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 303 } |
307 | 304 |
308 SkNi thenElse(const SkNi& t, const SkNi& e) const { | 305 SkNi thenElse(const SkNi& t, const SkNi& e) const { |
309 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec), | 306 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec), |
310 _mm_andnot_si128(fVec, e.fVec)); | 307 _mm_andnot_si128(fVec, e.fVec)); |
311 } | 308 } |
312 | 309 |
313 __m128i fVec; | 310 __m128i fVec; |
314 }; | 311 }; |
315 | 312 |
316 } // namespace | |
317 | |
318 #endif//SkNx_sse_DEFINED | 313 #endif//SkNx_sse_DEFINED |
OLD | NEW |