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

Side by Side Diff: src/opts/SkOpts_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/SkOpts_neon.cpp ('k') | src/opts/SkUtils_opts_SSE2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "SkOpts.h" 8 #include "SkOpts.h"
9 9
10 namespace sse2 { // This helps identify methods from this file when debugging / profiling.
11
12 static void memset16(uint16_t* dst, uint16_t val, int n) {
13 auto dst8 = (__m128i*)dst;
14 auto val8 = _mm_set1_epi16(val);
15 for ( ; n >= 8; n -= 8) {
16 _mm_storeu_si128(dst8++, val8);
17 }
18 dst = (uint16_t*)dst8;
19 if (n & 4) {
20 _mm_storel_epi64((__m128i*)dst, val8);
21 dst += 4;
22 }
23 if (n & 2) {
24 *(uint32_t*)dst = _mm_cvtsi128_si32(val8);
25 dst += 2;
26 }
27 if (n & 1) {
28 *dst = val;
29 }
30 }
31
32 static void memset32(uint32_t* dst, uint32_t val, int n) {
33 auto dst4 = (__m128i*)dst;
34 auto val4 = _mm_set1_epi32(val);
35 for ( ; n >= 4; n -= 4) {
36 _mm_storeu_si128(dst4++, val4);
37 }
38 dst = (uint32_t*)dst4;
39 if (n & 2) {
40 _mm_storel_epi64((__m128i*)dst, val4);
41 dst += 2;
42 }
43 if (n & 1) {
44 *dst = val;
45 }
46 }
47
48 } // namespace sse2
49
10 namespace SkOpts { 50 namespace SkOpts {
11 void Init_sse2() { 51 void Init_sse2() {
12 52 memset16 = sse2::memset16;
53 memset32 = sse2::memset32;
13 } 54 }
14 } 55 }
OLDNEW
« no previous file with comments | « src/opts/SkOpts_neon.cpp ('k') | src/opts/SkUtils_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698