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

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

Issue 1109913002: Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: arm64 typos Created 5 years, 7 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Nb operator != (const SkNf& o) const { return _mm_castps_si128(_mm_cmpneq_ps (fVec, o.fVec)); } 75 Nb operator != (const SkNf& o) const { return _mm_castps_si128(_mm_cmpneq_ps (fVec, o.fVec)); }
76 Nb operator < (const SkNf& o) const { return _mm_castps_si128(_mm_cmplt_ps (fVec, o.fVec)); } 76 Nb operator < (const SkNf& o) const { return _mm_castps_si128(_mm_cmplt_ps (fVec, o.fVec)); }
77 Nb operator > (const SkNf& o) const { return _mm_castps_si128(_mm_cmpgt_ps (fVec, o.fVec)); } 77 Nb operator > (const SkNf& o) const { return _mm_castps_si128(_mm_cmpgt_ps (fVec, o.fVec)); }
78 Nb operator <= (const SkNf& o) const { return _mm_castps_si128(_mm_cmple_ps (fVec, o.fVec)); } 78 Nb operator <= (const SkNf& o) const { return _mm_castps_si128(_mm_cmple_ps (fVec, o.fVec)); }
79 Nb operator >= (const SkNf& o) const { return _mm_castps_si128(_mm_cmpge_ps (fVec, o.fVec)); } 79 Nb operator >= (const SkNf& o) const { return _mm_castps_si128(_mm_cmpge_ps (fVec, o.fVec)); }
80 80
81 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_ps(l.fVec, r. fVec); } 81 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_ps(l.fVec, r. fVec); }
82 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_ps(l.fVec, r. fVec); } 82 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_ps(l.fVec, r. fVec); }
83 83
84 SkNf sqrt() const { return _mm_sqrt_ps (fVec); } 84 SkNf sqrt() const { return _mm_sqrt_ps (fVec); }
85 SkNf rsqrt() const { return _mm_rsqrt_ps(fVec); } 85 SkNf rsqrt0() const { return _mm_rsqrt_ps(fVec); }
86 SkNf rsqrt1() const { return this->rsqrt0(); }
87 SkNf rsqrt2() const { return this->rsqrt1(); }
86 88
87 SkNf invert() const { return SkNf(1) / *this; } 89 SkNf invert() const { return SkNf(1) / *this; }
88 SkNf approxInvert() const { return _mm_rcp_ps(fVec); } 90 SkNf approxInvert() const { return _mm_rcp_ps(fVec); }
89 91
90 template <int k> float kth() const { 92 template <int k> float kth() const {
91 SkASSERT(0 <= k && k < 2); 93 SkASSERT(0 <= k && k < 2);
92 union { __m128 v; float fs[4]; } pun = {fVec}; 94 union { __m128 v; float fs[4]; } pun = {fVec};
93 return pun.fs[k&1]; 95 return pun.fs[k&1];
94 } 96 }
95 97
(...skipping 23 matching lines...) Expand all
119 Nb operator != (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpneq_pd (fVec, o.fVec)); } 121 Nb operator != (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpneq_pd (fVec, o.fVec)); }
120 Nb operator < (const SkNf& o) const { return _mm_castpd_si128(_mm_cmplt_pd (fVec, o.fVec)); } 122 Nb operator < (const SkNf& o) const { return _mm_castpd_si128(_mm_cmplt_pd (fVec, o.fVec)); }
121 Nb operator > (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpgt_pd (fVec, o.fVec)); } 123 Nb operator > (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpgt_pd (fVec, o.fVec)); }
122 Nb operator <= (const SkNf& o) const { return _mm_castpd_si128(_mm_cmple_pd (fVec, o.fVec)); } 124 Nb operator <= (const SkNf& o) const { return _mm_castpd_si128(_mm_cmple_pd (fVec, o.fVec)); }
123 Nb operator >= (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpge_pd (fVec, o.fVec)); } 125 Nb operator >= (const SkNf& o) const { return _mm_castpd_si128(_mm_cmpge_pd (fVec, o.fVec)); }
124 126
125 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_pd(l.fVec, r. fVec); } 127 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_pd(l.fVec, r. fVec); }
126 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_pd(l.fVec, r. fVec); } 128 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_pd(l.fVec, r. fVec); }
127 129
128 SkNf sqrt() const { return _mm_sqrt_pd(fVec); } 130 SkNf sqrt() const { return _mm_sqrt_pd(fVec); }
129 SkNf rsqrt() const { return _mm_cvtps_pd(_mm_rsqrt_ps(_mm_cvtpd_ps(fVec))); } 131 SkNf rsqrt0() const { return _mm_cvtps_pd(_mm_rsqrt_ps(_mm_cvtpd_ps(fVec))); }
132 SkNf rsqrt1() const { return this->rsqrt0(); }
133 SkNf rsqrt2() const { return this->rsqrt1(); }
130 134
131 SkNf invert() const { return SkNf(1) / *this; } 135 SkNf invert() const { return SkNf(1) / *this; }
132 SkNf approxInvert() const { return _mm_cvtps_pd(_mm_rcp_ps(_mm_cvtpd_ps(fVec ))); } 136 SkNf approxInvert() const { return _mm_cvtps_pd(_mm_rcp_ps(_mm_cvtpd_ps(fVec ))); }
133 137
134 template <int k> double kth() const { 138 template <int k> double kth() const {
135 SkASSERT(0 <= k && k < 2); 139 SkASSERT(0 <= k && k < 2);
136 union { __m128d v; double ds[2]; } pun = {fVec}; 140 union { __m128d v; double ds[2]; } pun = {fVec};
137 return pun.ds[k&1]; 141 return pun.ds[k&1];
138 } 142 }
139 143
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 Nb operator != (const SkNf& o) const { return _mm_castps_si128(_mm_cmpneq_ps (fVec, o.fVec)); } 207 Nb operator != (const SkNf& o) const { return _mm_castps_si128(_mm_cmpneq_ps (fVec, o.fVec)); }
204 Nb operator < (const SkNf& o) const { return _mm_castps_si128(_mm_cmplt_ps (fVec, o.fVec)); } 208 Nb operator < (const SkNf& o) const { return _mm_castps_si128(_mm_cmplt_ps (fVec, o.fVec)); }
205 Nb operator > (const SkNf& o) const { return _mm_castps_si128(_mm_cmpgt_ps (fVec, o.fVec)); } 209 Nb operator > (const SkNf& o) const { return _mm_castps_si128(_mm_cmpgt_ps (fVec, o.fVec)); }
206 Nb operator <= (const SkNf& o) const { return _mm_castps_si128(_mm_cmple_ps (fVec, o.fVec)); } 210 Nb operator <= (const SkNf& o) const { return _mm_castps_si128(_mm_cmple_ps (fVec, o.fVec)); }
207 Nb operator >= (const SkNf& o) const { return _mm_castps_si128(_mm_cmpge_ps (fVec, o.fVec)); } 211 Nb operator >= (const SkNf& o) const { return _mm_castps_si128(_mm_cmpge_ps (fVec, o.fVec)); }
208 212
209 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_ps(l.fVec, r. fVec); } 213 static SkNf Min(const SkNf& l, const SkNf& r) { return _mm_min_ps(l.fVec, r. fVec); }
210 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_ps(l.fVec, r. fVec); } 214 static SkNf Max(const SkNf& l, const SkNf& r) { return _mm_max_ps(l.fVec, r. fVec); }
211 215
212 SkNf sqrt() const { return _mm_sqrt_ps (fVec); } 216 SkNf sqrt() const { return _mm_sqrt_ps (fVec); }
213 SkNf rsqrt() const { return _mm_rsqrt_ps(fVec); } 217 SkNf rsqrt0() const { return _mm_rsqrt_ps(fVec); }
218 SkNf rsqrt1() const { return this->rsqrt0(); }
219 SkNf rsqrt2() const { return this->rsqrt1(); }
214 220
215 SkNf invert() const { return SkNf(1) / *this; } 221 SkNf invert() const { return SkNf(1) / *this; }
216 SkNf approxInvert() const { return _mm_rcp_ps(fVec); } 222 SkNf approxInvert() const { return _mm_rcp_ps(fVec); }
217 223
218 template <int k> float kth() const { 224 template <int k> float kth() const {
219 SkASSERT(0 <= k && k < 4); 225 SkASSERT(0 <= k && k < 4);
220 union { __m128 v; float fs[4]; } pun = {fVec}; 226 union { __m128 v; float fs[4]; } pun = {fVec};
221 return pun.fs[k&3]; 227 return pun.fs[k&3];
222 } 228 }
223 229
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 280
275 template <int k> uint16_t kth() const { 281 template <int k> uint16_t kth() const {
276 SkASSERT(0 <= k && k < 8); 282 SkASSERT(0 <= k && k < 8);
277 return _mm_extract_epi16(fVec, k); 283 return _mm_extract_epi16(fVec, k);
278 } 284 }
279 protected: 285 protected:
280 __m128i fVec; 286 __m128i fVec;
281 }; 287 };
282 288
283 #endif//SkNx_sse_DEFINED 289 #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