OLD | NEW |
1 // It is important _not_ to put header guards here. | 1 // It is important _not_ to put header guards here. |
2 // This file will be intentionally included three times. | 2 // This file will be intentionally included three times. |
3 | 3 |
4 #include "SkTypes.h" // Keep this before any #ifdef for skbug.com/3362 | 4 #include "SkTypes.h" // Keep this before any #ifdef for skbug.com/3362 |
5 | 5 |
6 #if defined(SK4X_PREAMBLE) | 6 #if defined(SK4X_PREAMBLE) |
7 #include <arm_neon.h> | 7 #include <arm_neon.h> |
8 | 8 |
9 // Template metaprogramming to map scalar types to vector types. | 9 // Template metaprogramming to map scalar types to vector types. |
10 template <typename T> struct SkScalarToSIMD; | 10 template <typename T> struct SkScalarToSIMD; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 M(Sk4i) equal (const Sk4f& o) const { return vreinterpretq_s32_u32(vce
qq_f32(fVec, o.fVec)); } | 92 M(Sk4i) equal (const Sk4f& o) const { return vreinterpretq_s32_u32(vce
qq_f32(fVec, o.fVec)); } |
93 M(Sk4i) notEqual (const Sk4f& o) const { return vreinterpretq_s32_u32(vmv
nq_u32(vceqq_f32(fVec, o.fVec))); } | 93 M(Sk4i) notEqual (const Sk4f& o) const { return vreinterpretq_s32_u32(vmv
nq_u32(vceqq_f32(fVec, o.fVec))); } |
94 M(Sk4i) lessThan (const Sk4f& o) const { return vreinterpretq_s32_u32(vcl
tq_f32(fVec, o.fVec)); } | 94 M(Sk4i) lessThan (const Sk4f& o) const { return vreinterpretq_s32_u32(vcl
tq_f32(fVec, o.fVec)); } |
95 M(Sk4i) greaterThan (const Sk4f& o) const { return vreinterpretq_s32_u32(vcg
tq_f32(fVec, o.fVec)); } | 95 M(Sk4i) greaterThan (const Sk4f& o) const { return vreinterpretq_s32_u32(vcg
tq_f32(fVec, o.fVec)); } |
96 M(Sk4i) lessThanEqual (const Sk4f& o) const { return vreinterpretq_s32_u32(vcl
eq_f32(fVec, o.fVec)); } | 96 M(Sk4i) lessThanEqual (const Sk4f& o) const { return vreinterpretq_s32_u32(vcl
eq_f32(fVec, o.fVec)); } |
97 M(Sk4i) greaterThanEqual(const Sk4f& o) const { return vreinterpretq_s32_u32(vcg
eq_f32(fVec, o.fVec)); } | 97 M(Sk4i) greaterThanEqual(const Sk4f& o) const { return vreinterpretq_s32_u32(vcg
eq_f32(fVec, o.fVec)); } |
98 | 98 |
99 M(Sk4f) Min(const Sk4f& a, const Sk4f& b) { return vminq_f32(a.fVec, b.fVec); } | 99 M(Sk4f) Min(const Sk4f& a, const Sk4f& b) { return vminq_f32(a.fVec, b.fVec); } |
100 M(Sk4f) Max(const Sk4f& a, const Sk4f& b) { return vmaxq_f32(a.fVec, b.fVec); } | 100 M(Sk4f) Max(const Sk4f& a, const Sk4f& b) { return vmaxq_f32(a.fVec, b.fVec); } |
101 | 101 |
| 102 M(Sk4f) aacc() const { return vtrnq_f32(fVec, fVec).val[0]; } |
| 103 M(Sk4f) bbdd() const { return vtrnq_f32(fVec, fVec).val[1]; } |
102 M(Sk4f) badc() const { return vrev64q_f32(fVec); } | 104 M(Sk4f) badc() const { return vrev64q_f32(fVec); } |
103 | 105 |
104 // Sk4i Methods | 106 // Sk4i Methods |
105 #undef M | 107 #undef M |
106 #define M(...) template <> inline __VA_ARGS__ Sk4i:: | 108 #define M(...) template <> inline __VA_ARGS__ Sk4i:: |
107 | 109 |
108 M() Sk4x(int32_t v) : fVec(vdupq_n_s32(v)) {} | 110 M() Sk4x(int32_t v) : fVec(vdupq_n_s32(v)) {} |
109 M() Sk4x(int32_t a, int32_t b, int32_t c, int32_t d) { fVec = (int32x4_t) { a, b
, c, d }; } | 111 M() Sk4x(int32_t a, int32_t b, int32_t c, int32_t d) { fVec = (int32x4_t) { a, b
, c, d }; } |
110 | 112 |
111 // As far as I can tell, it's not possible to provide an alignment hint to | 113 // As far as I can tell, it's not possible to provide an alignment hint to |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 M(Sk4i) lessThanEqual (const Sk4i& o) const { return vreinterpretq_s32_u32(vcl
eq_s32(fVec, o.fVec)); } | 150 M(Sk4i) lessThanEqual (const Sk4i& o) const { return vreinterpretq_s32_u32(vcl
eq_s32(fVec, o.fVec)); } |
149 M(Sk4i) greaterThanEqual(const Sk4i& o) const { return vreinterpretq_s32_u32(vcg
eq_s32(fVec, o.fVec)); } | 151 M(Sk4i) greaterThanEqual(const Sk4i& o) const { return vreinterpretq_s32_u32(vcg
eq_s32(fVec, o.fVec)); } |
150 | 152 |
151 M(Sk4i) add (const Sk4i& o) const { return vaddq_s32(fVec, o.fVec); } | 153 M(Sk4i) add (const Sk4i& o) const { return vaddq_s32(fVec, o.fVec); } |
152 M(Sk4i) subtract(const Sk4i& o) const { return vsubq_s32(fVec, o.fVec); } | 154 M(Sk4i) subtract(const Sk4i& o) const { return vsubq_s32(fVec, o.fVec); } |
153 M(Sk4i) multiply(const Sk4i& o) const { return vmulq_s32(fVec, o.fVec); } | 155 M(Sk4i) multiply(const Sk4i& o) const { return vmulq_s32(fVec, o.fVec); } |
154 // NEON does not have integer reciprocal, sqrt, or division. | 156 // NEON does not have integer reciprocal, sqrt, or division. |
155 M(Sk4i) Min(const Sk4i& a, const Sk4i& b) { return vminq_s32(a.fVec, b.fVec); } | 157 M(Sk4i) Min(const Sk4i& a, const Sk4i& b) { return vminq_s32(a.fVec, b.fVec); } |
156 M(Sk4i) Max(const Sk4i& a, const Sk4i& b) { return vmaxq_s32(a.fVec, b.fVec); } | 158 M(Sk4i) Max(const Sk4i& a, const Sk4i& b) { return vmaxq_s32(a.fVec, b.fVec); } |
157 | 159 |
| 160 M(Sk4i) aacc() const { return vtrnq_s32(fVec, fVec).val[0]; } |
| 161 M(Sk4i) bbdd() const { return vtrnq_s32(fVec, fVec).val[1]; } |
158 M(Sk4i) badc() const { return vrev64q_s32(fVec); } | 162 M(Sk4i) badc() const { return vrev64q_s32(fVec); } |
159 | 163 |
160 #undef M | 164 #undef M |
161 | 165 |
162 #endif | 166 #endif |
OLD | NEW |