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

Side by Side Diff: src/opts/SkUtils_opts_SSE2.cpp

Issue 1270573002: Port SkUtils opts to SkOpts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: derek Created 5 years, 4 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/SkUtils_opts_SSE2.h ('k') | src/opts/SkUtils_opts_arm.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2009 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include <emmintrin.h>
9 #include "SkUtils_opts_SSE2.h"
10
11 void sk_memset16_SSE2(uint16_t *dst, uint16_t value, int count)
12 {
13 SkASSERT(dst != NULL && count >= 0);
14
15 // dst must be 2-byte aligned.
16 SkASSERT((((size_t) dst) & 0x01) == 0);
17
18 if (count >= 32) {
19 while (((size_t)dst) & 0x0F) {
20 *dst++ = value;
21 --count;
22 }
23 __m128i *d = reinterpret_cast<__m128i*>(dst);
24 __m128i value_wide = _mm_set1_epi16(value);
25 while (count >= 32) {
26 _mm_store_si128(d , value_wide);
27 _mm_store_si128(d + 1, value_wide);
28 _mm_store_si128(d + 2, value_wide);
29 _mm_store_si128(d + 3, value_wide);
30 d += 4;
31 count -= 32;
32 }
33 dst = reinterpret_cast<uint16_t*>(d);
34 }
35 while (count > 0) {
36 *dst++ = value;
37 --count;
38 }
39 }
40
41 void sk_memset32_SSE2(uint32_t *dst, uint32_t value, int count)
42 {
43 SkASSERT(dst != NULL && count >= 0);
44
45 // dst must be 4-byte aligned.
46 SkASSERT((((size_t) dst) & 0x03) == 0);
47
48 if (count >= 16) {
49 while (((size_t)dst) & 0x0F) {
50 *dst++ = value;
51 --count;
52 }
53 __m128i *d = reinterpret_cast<__m128i*>(dst);
54 __m128i value_wide = _mm_set1_epi32(value);
55 while (count >= 16) {
56 _mm_store_si128(d , value_wide);
57 _mm_store_si128(d + 1, value_wide);
58 _mm_store_si128(d + 2, value_wide);
59 _mm_store_si128(d + 3, value_wide);
60 d += 4;
61 count -= 16;
62 }
63 dst = reinterpret_cast<uint32_t*>(d);
64 }
65 while (count > 0) {
66 *dst++ = value;
67 --count;
68 }
69 }
OLDNEW
« no previous file with comments | « src/opts/SkUtils_opts_SSE2.h ('k') | src/opts/SkUtils_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698