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

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

Issue 1230663005: 3-15% speedup to HardLight / Overlay xfermodes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add a test that widenLo() | widenHi() == widenLoHi() Created 5 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/SkNxTest.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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 static SkNi Min(const SkNi& a, const SkNi& b) { 251 static SkNi Min(const SkNi& a, const SkNi& b) {
252 // No unsigned _mm_min_epu16, so we'll shift into a space where we can u se the 252 // No unsigned _mm_min_epu16, so we'll shift into a space where we can u se the
253 // signed version, _mm_min_epi16, then shift back. 253 // signed version, _mm_min_epi16, then shift back.
254 const uint16_t top = 0x8000; // Keep this separate from _mm_set1_epi16 o r MSVC will whine. 254 const uint16_t top = 0x8000; // Keep this separate from _mm_set1_epi16 o r MSVC will whine.
255 const __m128i top_8x = _mm_set1_epi16(top); 255 const __m128i top_8x = _mm_set1_epi16(top);
256 return _mm_add_epi8(top_8x, _mm_min_epi16(_mm_sub_epi8(a.fVec, top_8x), 256 return _mm_add_epi8(top_8x, _mm_min_epi16(_mm_sub_epi8(a.fVec, top_8x),
257 _mm_sub_epi8(b.fVec, top_8x))) ; 257 _mm_sub_epi8(b.fVec, top_8x))) ;
258 } 258 }
259 259
260 SkNi thenElse(const SkNi& t, const SkNi& e) const {
261 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec),
262 _mm_andnot_si128(fVec, e.fVec));
263 }
264
260 template <int k> uint16_t kth() const { 265 template <int k> uint16_t kth() const {
261 SkASSERT(0 <= k && k < 8); 266 SkASSERT(0 <= k && k < 8);
262 return _mm_extract_epi16(fVec, k); 267 return _mm_extract_epi16(fVec, k);
263 } 268 }
264 269
265 __m128i fVec; 270 __m128i fVec;
266 }; 271 };
267 272
268 template <> 273 template <>
269 class SkNi<16, uint8_t> { 274 class SkNi<16, uint8_t> {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec), 309 return _mm_or_si128(_mm_and_si128 (fVec, t.fVec),
305 _mm_andnot_si128(fVec, e.fVec)); 310 _mm_andnot_si128(fVec, e.fVec));
306 } 311 }
307 312
308 __m128i fVec; 313 __m128i fVec;
309 }; 314 };
310 315
311 } // namespace 316 } // namespace
312 317
313 #endif//SkNx_sse_DEFINED 318 #endif//SkNx_sse_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkNx_neon.h ('k') | tests/SkNxTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698