OLD | NEW |
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_neon_DEFINED | 8 #ifndef SkNx_neon_DEFINED |
9 #define SkNx_neon_DEFINED | 9 #define SkNx_neon_DEFINED |
10 | 10 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 auto v = vreinterpretq_u32_f32(fVec); | 290 auto v = vreinterpretq_u32_f32(fVec); |
291 return vgetq_lane_u32(v,0) && vgetq_lane_u32(v,1) | 291 return vgetq_lane_u32(v,0) && vgetq_lane_u32(v,1) |
292 && vgetq_lane_u32(v,2) && vgetq_lane_u32(v,3); | 292 && vgetq_lane_u32(v,2) && vgetq_lane_u32(v,3); |
293 } | 293 } |
294 bool anyTrue() const { | 294 bool anyTrue() const { |
295 auto v = vreinterpretq_u32_f32(fVec); | 295 auto v = vreinterpretq_u32_f32(fVec); |
296 return vgetq_lane_u32(v,0) || vgetq_lane_u32(v,1) | 296 return vgetq_lane_u32(v,0) || vgetq_lane_u32(v,1) |
297 || vgetq_lane_u32(v,2) || vgetq_lane_u32(v,3); | 297 || vgetq_lane_u32(v,2) || vgetq_lane_u32(v,3); |
298 } | 298 } |
299 | 299 |
| 300 SkNf thenElse(const SkNf& t, const SkNf& e) const { |
| 301 uint32x4_t ci = vreinterpretq_u32_f32(fVec), |
| 302 ti = vreinterpretq_u32_f32(t.fVec), |
| 303 ei = vreinterpretq_u32_f32(e.fVec); |
| 304 return vreinterpretq_f32_u32(vorrq_u32(vandq_u32(ti, ci), vbicq_u32(ei,
ci))); |
| 305 } |
| 306 |
300 float32x4_t fVec; | 307 float32x4_t fVec; |
301 }; | 308 }; |
302 | 309 |
303 template <> | 310 template <> |
304 class SkNi<8, uint16_t> { | 311 class SkNi<8, uint16_t> { |
305 public: | 312 public: |
306 SkNi(const uint16x8_t& vec) : fVec(vec) {} | 313 SkNi(const uint16x8_t& vec) : fVec(vec) {} |
307 | 314 |
308 SkNi() {} | 315 SkNi() {} |
309 explicit SkNi(uint16_t val) : fVec(vdupq_n_u16(val)) {} | 316 explicit SkNi(uint16_t val) : fVec(vdupq_n_u16(val)) {} |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 uint8x16_t fVec; | 379 uint8x16_t fVec; |
373 }; | 380 }; |
374 | 381 |
375 #undef SHIFT32 | 382 #undef SHIFT32 |
376 #undef SHIFT16 | 383 #undef SHIFT16 |
377 #undef SHIFT8 | 384 #undef SHIFT8 |
378 | 385 |
379 } // namespace | 386 } // namespace |
380 | 387 |
381 #endif//SkNx_neon_DEFINED | 388 #endif//SkNx_neon_DEFINED |
OLD | NEW |