| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 The Android Open Source Project |
| 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 #include <emmintrin.h> | 8 #include <emmintrin.h> |
| 9 #include "SkUtils_opts_SSE2.h" | 9 #include "SkUtils_opts_SSE2.h" |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 d += 4; | 60 d += 4; |
| 61 count -= 16; | 61 count -= 16; |
| 62 } | 62 } |
| 63 dst = reinterpret_cast<uint32_t*>(d); | 63 dst = reinterpret_cast<uint32_t*>(d); |
| 64 } | 64 } |
| 65 while (count > 0) { | 65 while (count > 0) { |
| 66 *dst++ = value; | 66 *dst++ = value; |
| 67 --count; | 67 --count; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | |
| 71 void sk_memcpy32_SSE2(uint32_t *dst, const uint32_t *src, int count) | |
| 72 { | |
| 73 if (count >= 16) { | |
| 74 while (((size_t)dst) & 0x0F) { | |
| 75 *dst++ = *src++; | |
| 76 --count; | |
| 77 } | |
| 78 __m128i *dst128 = reinterpret_cast<__m128i*>(dst); | |
| 79 const __m128i *src128 = reinterpret_cast<const __m128i*>(src); | |
| 80 while (count >= 16) { | |
| 81 __m128i a = _mm_loadu_si128(src128++); | |
| 82 __m128i b = _mm_loadu_si128(src128++); | |
| 83 __m128i c = _mm_loadu_si128(src128++); | |
| 84 __m128i d = _mm_loadu_si128(src128++); | |
| 85 | |
| 86 _mm_store_si128(dst128++, a); | |
| 87 _mm_store_si128(dst128++, b); | |
| 88 _mm_store_si128(dst128++, c); | |
| 89 _mm_store_si128(dst128++, d); | |
| 90 count -= 16; | |
| 91 } | |
| 92 dst = reinterpret_cast<uint32_t*>(dst128); | |
| 93 src = reinterpret_cast<const uint32_t*>(src128); | |
| 94 } | |
| 95 while (count > 0) { | |
| 96 *dst++ = *src++; | |
| 97 --count; | |
| 98 } | |
| 99 } | |
| OLD | NEW |