Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: src/opts/SkNx_sse.h

Issue 2144573004: SkRasterPipeline preliminaries (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: MSVC x86 vetoed lambdas. :( Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/opts/SkNx_neon.h ('k') | tests/SkRasterPipelineTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 SkNx operator + (const SkNx& o) const { return _mm_add_epi32(fVec, o.fVec); } 144 SkNx operator + (const SkNx& o) const { return _mm_add_epi32(fVec, o.fVec); }
145 SkNx operator - (const SkNx& o) const { return _mm_sub_epi32(fVec, o.fVec); } 145 SkNx operator - (const SkNx& o) const { return _mm_sub_epi32(fVec, o.fVec); }
146 SkNx operator * (const SkNx& o) const { 146 SkNx operator * (const SkNx& o) const {
147 __m128i mul20 = _mm_mul_epu32(fVec, o.fVec), 147 __m128i mul20 = _mm_mul_epu32(fVec, o.fVec),
148 mul31 = _mm_mul_epu32(_mm_srli_si128(fVec, 4), _mm_srli_si128(o. fVec, 4)); 148 mul31 = _mm_mul_epu32(_mm_srli_si128(fVec, 4), _mm_srli_si128(o. fVec, 4));
149 return _mm_unpacklo_epi32(_mm_shuffle_epi32(mul20, _MM_SHUFFLE(0,0,2,0)) , 149 return _mm_unpacklo_epi32(_mm_shuffle_epi32(mul20, _MM_SHUFFLE(0,0,2,0)) ,
150 _mm_shuffle_epi32(mul31, _MM_SHUFFLE(0,0,2,0)) ); 150 _mm_shuffle_epi32(mul31, _MM_SHUFFLE(0,0,2,0)) );
151 } 151 }
152 152
153 SkNx operator & (const SkNx& o) const { return _mm_and_si128(fVec, o.fVec); }
153 SkNx operator | (const SkNx& o) const { return _mm_or_si128(fVec, o.fVec); } 154 SkNx operator | (const SkNx& o) const { return _mm_or_si128(fVec, o.fVec); }
154 155
155 SkNx operator << (int bits) const { return _mm_slli_epi32(fVec, bits); } 156 SkNx operator << (int bits) const { return _mm_slli_epi32(fVec, bits); }
156 SkNx operator >> (int bits) const { return _mm_srai_epi32(fVec, bits); } 157 SkNx operator >> (int bits) const { return _mm_srai_epi32(fVec, bits); }
157 158
158 int operator[](int k) const { 159 int operator[](int k) const {
159 SkASSERT(0 <= k && k < 4); 160 SkASSERT(0 <= k && k < 4);
160 union { __m128i v; int is[4]; } pun = {fVec}; 161 union { __m128i v; int is[4]; } pun = {fVec};
161 return pun.is[k&3]; 162 return pun.is[k&3];
162 } 163 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 366
366 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) { 367 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) {
367 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); 368 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128());
368 } 369 }
369 370
370 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) { 371 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) {
371 return _mm_packus_epi16(src.fVec, src.fVec); 372 return _mm_packus_epi16(src.fVec, src.fVec);
372 } 373 }
373 374
374 #endif//SkNx_sse_DEFINED 375 #endif//SkNx_sse_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkNx_neon.h ('k') | tests/SkRasterPipelineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698