| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 uint16x8_t fVec; | 299 uint16x8_t fVec; |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 template <> | 302 template <> |
| 303 class SkNx<4, uint8_t> { | 303 class SkNx<4, uint8_t> { |
| 304 public: | 304 public: |
| 305 SkNx(const uint8x8_t& vec) : fVec(vec) {} | 305 SkNx(const uint8x8_t& vec) : fVec(vec) {} |
| 306 | 306 |
| 307 SkNx() {} | 307 SkNx() {} |
| 308 SkNx(uint8_t a, uint8_t b, uint8_t c, uint8_t d) { |
| 309 fVec = (uint8x8_t){a,b,c,d, 0,0,0,0}; |
| 310 } |
| 308 static SkNx Load(const void* ptr) { | 311 static SkNx Load(const void* ptr) { |
| 309 return (uint8x8_t)vld1_dup_u32((const uint32_t*)ptr); | 312 return (uint8x8_t)vld1_dup_u32((const uint32_t*)ptr); |
| 310 } | 313 } |
| 311 void store(void* ptr) const { | 314 void store(void* ptr) const { |
| 312 return vst1_lane_u32((uint32_t*)ptr, (uint32x2_t)fVec, 0); | 315 return vst1_lane_u32((uint32_t*)ptr, (uint32x2_t)fVec, 0); |
| 313 } | 316 } |
| 317 uint8_t operator[](int k) const { |
| 318 SkASSERT(0 <= k && k < 4); |
| 319 union { uint8x8_t v; uint8_t us[8]; } pun = {fVec}; |
| 320 return pun.us[k&3]; |
| 321 } |
| 314 | 322 |
| 315 // TODO as needed | 323 // TODO as needed |
| 316 | 324 |
| 317 uint8x8_t fVec; | 325 uint8x8_t fVec; |
| 318 }; | 326 }; |
| 319 | 327 |
| 320 template <> | 328 template <> |
| 321 class SkNx<16, uint8_t> { | 329 class SkNx<16, uint8_t> { |
| 322 public: | 330 public: |
| 323 SkNx(const uint8x16_t& vec) : fVec(vec) {} | 331 SkNx(const uint8x16_t& vec) : fVec(vec) {} |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 398 |
| 391 template<> inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) { | 399 template<> inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) { |
| 392 return vget_low_u16(vmovl_u8(src.fVec)); | 400 return vget_low_u16(vmovl_u8(src.fVec)); |
| 393 } | 401 } |
| 394 | 402 |
| 395 template<> inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) { | 403 template<> inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) { |
| 396 return vmovn_u16(vcombine_u16(src.fVec, src.fVec)); | 404 return vmovn_u16(vcombine_u16(src.fVec, src.fVec)); |
| 397 } | 405 } |
| 398 | 406 |
| 399 #endif//SkNx_neon_DEFINED | 407 #endif//SkNx_neon_DEFINED |
| OLD | NEW |