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

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

Issue 1590843003: add SkNx::abs(), for now only implemented for Sk4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkTAbs Created 4 years, 11 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SkNx operator == (const SkNx& o) const { return _mm_cmpeq_ps (fVec, o.fVec); } 169 SkNx operator == (const SkNx& o) const { return _mm_cmpeq_ps (fVec, o.fVec); }
170 SkNx operator != (const SkNx& o) const { return _mm_cmpneq_ps(fVec, o.fVec); } 170 SkNx operator != (const SkNx& o) const { return _mm_cmpneq_ps(fVec, o.fVec); }
171 SkNx operator < (const SkNx& o) const { return _mm_cmplt_ps (fVec, o.fVec); } 171 SkNx operator < (const SkNx& o) const { return _mm_cmplt_ps (fVec, o.fVec); }
172 SkNx operator > (const SkNx& o) const { return _mm_cmpgt_ps (fVec, o.fVec); } 172 SkNx operator > (const SkNx& o) const { return _mm_cmpgt_ps (fVec, o.fVec); }
173 SkNx operator <= (const SkNx& o) const { return _mm_cmple_ps (fVec, o.fVec); } 173 SkNx operator <= (const SkNx& o) const { return _mm_cmple_ps (fVec, o.fVec); }
174 SkNx operator >= (const SkNx& o) const { return _mm_cmpge_ps (fVec, o.fVec); } 174 SkNx operator >= (const SkNx& o) const { return _mm_cmpge_ps (fVec, o.fVec); }
175 175
176 static SkNx Min(const SkNx& l, const SkNx& r) { return _mm_min_ps(l.fVec, r. fVec); } 176 static SkNx Min(const SkNx& l, const SkNx& r) { return _mm_min_ps(l.fVec, r. fVec); }
177 static SkNx Max(const SkNx& l, const SkNx& r) { return _mm_max_ps(l.fVec, r. fVec); } 177 static SkNx Max(const SkNx& l, const SkNx& r) { return _mm_max_ps(l.fVec, r. fVec); }
178 178
179 SkNx abs() const { return _mm_andnot_ps(_mm_set1_ps(-0.0f), fVec); }
180
179 SkNx sqrt() const { return _mm_sqrt_ps (fVec); } 181 SkNx sqrt() const { return _mm_sqrt_ps (fVec); }
180 SkNx rsqrt0() const { return _mm_rsqrt_ps(fVec); } 182 SkNx rsqrt0() const { return _mm_rsqrt_ps(fVec); }
181 SkNx rsqrt1() const { return this->rsqrt0(); } 183 SkNx rsqrt1() const { return this->rsqrt0(); }
182 SkNx rsqrt2() const { return this->rsqrt1(); } 184 SkNx rsqrt2() const { return this->rsqrt1(); }
183 185
184 SkNx invert() const { return SkNx(1) / *this; } 186 SkNx invert() const { return SkNx(1) / *this; }
185 SkNx approxInvert() const { return _mm_rcp_ps(fVec); } 187 SkNx approxInvert() const { return _mm_rcp_ps(fVec); }
186 188
187 template <int k> float kth() const { 189 template <int k> float kth() const {
188 SkASSERT(0 <= k && k < 4); 190 SkASSERT(0 <= k && k < 4);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 _mm_packus_epi16(_mm_packus_epi16(_mm_cvttps_epi32(a.fVec), 376 _mm_packus_epi16(_mm_packus_epi16(_mm_cvttps_epi32(a.fVec),
375 _mm_cvttps_epi32(b.fVec)) , 377 _mm_cvttps_epi32(b.fVec)) ,
376 _mm_packus_epi16(_mm_cvttps_epi32(c.fVec), 378 _mm_packus_epi16(_mm_cvttps_epi32(c.fVec),
377 _mm_cvttps_epi32(d.fVec)) )); 379 _mm_cvttps_epi32(d.fVec)) ));
378 } 380 }
379 381
380 382
381 } // namespace 383 } // namespace
382 384
383 #endif//SkNx_sse_DEFINED 385 #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