| 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_avx_DEFINED | 8 #ifndef SkNx_avx_DEFINED |
| 9 #define SkNx_avx_DEFINED | 9 #define SkNx_avx_DEFINED |
| 10 | 10 |
| 11 // This file may assume <= AVX, but must check SK_CPU_SSE_LEVEL for anything mor
e recent. | 11 // This file may assume <= AVX, but must check SK_CPU_SSE_LEVEL for anything mor
e recent. |
| 12 | 12 |
| 13 // All the SSE specializations are still good ideas. We'll just add Sk8f. | 13 // All the SSE specializations are still good ideas. We'll just add Sk8f. |
| 14 #include "SkNx_sse.h" | 14 #include "SkNx_sse.h" |
| 15 | 15 |
| 16 // SkNx_sse.h defines SKNX_IS_FAST. |
| 17 |
| 16 namespace { // See SkNx.h | 18 namespace { // See SkNx.h |
| 17 | 19 |
| 18 template <> | 20 template <> |
| 19 class SkNx<8, float> { | 21 class SkNx<8, float> { |
| 20 public: | 22 public: |
| 21 SkNx(const __m256& vec) : fVec(vec) {} | 23 SkNx(const __m256& vec) : fVec(vec) {} |
| 22 | 24 |
| 23 SkNx() {} | 25 SkNx() {} |
| 24 SkNx(float val) : fVec(_mm256_set1_ps(val)) {} | 26 SkNx(float val) : fVec(_mm256_set1_ps(val)) {} |
| 25 static SkNx Load(const float vals[8]) { return _mm256_loadu_ps(vals); } | 27 static SkNx Load(const float vals[8]) { return _mm256_loadu_ps(vals); } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 SkNx thenElse(const SkNx& t, const SkNx& e) const { | 83 SkNx thenElse(const SkNx& t, const SkNx& e) const { |
| 82 return _mm256_blendv_ps(e.fVec, t.fVec, fVec); | 84 return _mm256_blendv_ps(e.fVec, t.fVec, fVec); |
| 83 } | 85 } |
| 84 | 86 |
| 85 __m256 fVec; | 87 __m256 fVec; |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace | 90 } // namespace |
| 89 | 91 |
| 90 #endif//SkNx_avx_DEFINED | 92 #endif//SkNx_avx_DEFINED |
| OLD | NEW |