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

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

Issue 1027753003: Add divide to Sk2x, use native vdiv and vsqrt on ARM 64. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 9 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/Sk2x_none.h ('k') | src/opts/Sk4x_neon.h » ('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 // It is important _not_ to put header guards here. 8 // It is important _not_ to put header guards here.
9 // This file will be intentionally included three times. 9 // This file will be intentionally included three times.
10 10
(...skipping 20 matching lines...) Expand all
31 M(Sk2f&) operator=(const Sk2f& o) { fVec = o.fVec; return *this; } 31 M(Sk2f&) operator=(const Sk2f& o) { fVec = o.fVec; return *this; }
32 32
33 M(Sk2f) Load(const float vals[2]) { 33 M(Sk2f) Load(const float vals[2]) {
34 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals)); 34 return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)vals));
35 } 35 }
36 M(void) store(float vals[2]) const { _mm_storel_pi((__m64*)vals, fVec); } 36 M(void) store(float vals[2]) const { _mm_storel_pi((__m64*)vals, fVec); }
37 37
38 M(Sk2f) add(const Sk2f& o) const { return _mm_add_ps(fVec, o.fVec); } 38 M(Sk2f) add(const Sk2f& o) const { return _mm_add_ps(fVec, o.fVec); }
39 M(Sk2f) subtract(const Sk2f& o) const { return _mm_sub_ps(fVec, o.fVec); } 39 M(Sk2f) subtract(const Sk2f& o) const { return _mm_sub_ps(fVec, o.fVec); }
40 M(Sk2f) multiply(const Sk2f& o) const { return _mm_mul_ps(fVec, o.fVec); } 40 M(Sk2f) multiply(const Sk2f& o) const { return _mm_mul_ps(fVec, o.fVec); }
41 M(Sk2f) divide(const Sk2f& o) const { return _mm_div_ps(fVec, o.fVec); }
41 42
42 M(Sk2f) Min(const Sk2f& a, const Sk2f& b) { return _mm_min_ps(a.fVec, b.fVec); } 43 M(Sk2f) Min(const Sk2f& a, const Sk2f& b) { return _mm_min_ps(a.fVec, b.fVec); }
43 M(Sk2f) Max(const Sk2f& a, const Sk2f& b) { return _mm_max_ps(a.fVec, b.fVec); } 44 M(Sk2f) Max(const Sk2f& a, const Sk2f& b) { return _mm_max_ps(a.fVec, b.fVec); }
44 45
45 M(Sk2f) rsqrt() const { return _mm_rsqrt_ps(fVec); } 46 M(Sk2f) rsqrt() const { return _mm_rsqrt_ps(fVec); }
46 M(Sk2f) sqrt() const { return _mm_sqrt_ps (fVec); } 47 M(Sk2f) sqrt() const { return _mm_sqrt_ps (fVec); }
47 48
48 #undef M 49 #undef M
49 50
50 #define M(...) template <> inline __VA_ARGS__ Sk2x<double>:: 51 #define M(...) template <> inline __VA_ARGS__ Sk2x<double>::
51 52
52 M() Sk2x() {} 53 M() Sk2x() {}
53 M() Sk2x(double val) { fVec = _mm_set1_pd(val); } 54 M() Sk2x(double val) { fVec = _mm_set1_pd(val); }
54 M() Sk2x(double a, double b) { fVec = _mm_set_pd(b, a); } 55 M() Sk2x(double a, double b) { fVec = _mm_set_pd(b, a); }
55 M(Sk2d&) operator=(const Sk2d& o) { fVec = o.fVec; return *this; } 56 M(Sk2d&) operator=(const Sk2d& o) { fVec = o.fVec; return *this; }
56 57
57 M(Sk2d) Load(const double vals[2]) { return _mm_loadu_pd(vals); } 58 M(Sk2d) Load(const double vals[2]) { return _mm_loadu_pd(vals); }
58 M(void) store(double vals[2]) const { _mm_storeu_pd(vals, fVec); } 59 M(void) store(double vals[2]) const { _mm_storeu_pd(vals, fVec); }
59 60
60 M(Sk2d) add(const Sk2d& o) const { return _mm_add_pd(fVec, o.fVec); } 61 M(Sk2d) add(const Sk2d& o) const { return _mm_add_pd(fVec, o.fVec); }
61 M(Sk2d) subtract(const Sk2d& o) const { return _mm_sub_pd(fVec, o.fVec); } 62 M(Sk2d) subtract(const Sk2d& o) const { return _mm_sub_pd(fVec, o.fVec); }
62 M(Sk2d) multiply(const Sk2d& o) const { return _mm_mul_pd(fVec, o.fVec); } 63 M(Sk2d) multiply(const Sk2d& o) const { return _mm_mul_pd(fVec, o.fVec); }
64 M(Sk2d) divide(const Sk2d& o) const { return _mm_div_pd(fVec, o.fVec); }
63 65
64 M(Sk2d) Min(const Sk2d& a, const Sk2d& b) { return _mm_min_pd(a.fVec, b.fVec); } 66 M(Sk2d) Min(const Sk2d& a, const Sk2d& b) { return _mm_min_pd(a.fVec, b.fVec); }
65 M(Sk2d) Max(const Sk2d& a, const Sk2d& b) { return _mm_max_pd(a.fVec, b.fVec); } 67 M(Sk2d) Max(const Sk2d& a, const Sk2d& b) { return _mm_max_pd(a.fVec, b.fVec); }
66 68
67 // There is no _mm_rsqrt_pd, so we do Sk2d::rsqrt() in floats. 69 // There is no _mm_rsqrt_pd, so we do Sk2d::rsqrt() in floats.
68 M(Sk2d) rsqrt() const { return _mm_cvtps_pd(_mm_rsqrt_ps(_mm_cvtpd_ps(fVec))); } 70 M(Sk2d) rsqrt() const { return _mm_cvtps_pd(_mm_rsqrt_ps(_mm_cvtpd_ps(fVec))); }
69 M(Sk2d) sqrt() const { return _mm_sqrt_pd(fVec); } 71 M(Sk2d) sqrt() const { return _mm_sqrt_pd(fVec); }
70 72
71 #undef M 73 #undef M
72 74
73 #endif 75 #endif
OLDNEW
« no previous file with comments | « src/opts/Sk2x_none.h ('k') | src/opts/Sk4x_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698