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

Side by Side Diff: src/opts/SkOpts_neon.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/core/SkUtils.cpp ('k') | src/opts/SkOpts_sse2.cpp » ('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 #include "SkFloatingPoint.h" 9 #include "SkFloatingPoint.h"
10 10
11 namespace neon { // This helps identify methods from this file when debugging / profiling.
12
13 static float rsqrt(float x) {
14 return sk_float_rsqrt(x); // This sk_float_rsqrt copy will take the NEON co mpile-time path.
15 }
16
17 static void memset16(uint16_t* dst, uint16_t value, int n) {
18 uint16x8_t v8 = vdupq_n_u16(value);
19 uint16x8x4_t v32 = {{ v8, v8, v8, v8 }};
20
21 while (n >= 32) {
22 vst4q_u16(dst, v32); // This swizzles, but we don't care: all lanes are the same, value.
23 dst += 32;
24 n -= 32;
25 }
26 switch (n / 8) {
27 case 3: vst1q_u16(dst, v8); dst += 8;
28 case 2: vst1q_u16(dst, v8); dst += 8;
29 case 1: vst1q_u16(dst, v8); dst += 8;
30 }
31 if (n & 4) {
32 vst1_u16(dst, vget_low_u16(v8));
33 dst += 4;
34 }
35 switch (n & 3) {
36 case 3: *dst++ = value;
37 case 2: *dst++ = value;
38 case 1: *dst = value;
39 }
40 }
41
42 static void memset32(uint32_t* dst, uint32_t value, int n) {
43 uint32x4_t v4 = vdupq_n_u32(value);
44 uint32x4x4_t v16 = {{ v4, v4, v4, v4 }};
45
46 while (n >= 16) {
47 vst4q_u32(dst, v16); // This swizzles, but we don't care: all lanes are the same, value.
48 dst += 16;
49 n -= 16;
50 }
51 switch (n / 4) {
52 case 3: vst1q_u32(dst, v4); dst += 4;
53 case 2: vst1q_u32(dst, v4); dst += 4;
54 case 1: vst1q_u32(dst, v4); dst += 4;
55 }
56 if (n & 2) {
57 vst1_u32(dst, vget_low_u32(v4));
58 dst += 2;
59 }
60 if (n & 1) {
61 *dst = value;
62 }
63 }
64
65 } // namespace neon
66
11 namespace SkOpts { 67 namespace SkOpts {
12 void Init_neon() { 68 void Init_neon() {
13 rsqrt = sk_float_rsqrt; // This copy of sk_float_rsqrt will take the NE ON path. 69 rsqrt = neon::rsqrt;
14 70 memset16 = neon::memset16;
71 memset32 = neon::memset32;
15 } 72 }
16 } 73 }
OLDNEW
« no previous file with comments | « src/core/SkUtils.cpp ('k') | src/opts/SkOpts_sse2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698