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

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

Issue 1264423002: Reorganize to keep similar code together. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/SkFloatingPoint_opts.h ('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 "SkFloatingPoint.h"
9 #include "SkOpts.h" 8 #include "SkOpts.h"
9
10 #define SK_OPTS_NS neon 10 #define SK_OPTS_NS neon
11 #include "SkBlurImageFilter_opts.h" 11 #include "SkBlurImageFilter_opts.h"
12 #include "SkFloatingPoint_opts.h"
13 #include "SkUtils_opts.h"
12 #include "SkXfermode_opts.h" 14 #include "SkXfermode_opts.h"
13 15
14 namespace neon { // This helps identify methods from this file when debugging / profiling.
15
16 static float rsqrt(float x) {
17 return sk_float_rsqrt(x); // This sk_float_rsqrt copy will take the NEON co mpile-time path.
18 }
19
20 static void memset16(uint16_t* dst, uint16_t value, int n) {
21 uint16x8_t v8 = vdupq_n_u16(value);
22 uint16x8x4_t v32 = {{ v8, v8, v8, v8 }};
23
24 while (n >= 32) {
25 vst4q_u16(dst, v32); // This swizzles, but we don't care: all lanes are the same, value.
26 dst += 32;
27 n -= 32;
28 }
29 switch (n / 8) {
30 case 3: vst1q_u16(dst, v8); dst += 8;
31 case 2: vst1q_u16(dst, v8); dst += 8;
32 case 1: vst1q_u16(dst, v8); dst += 8;
33 }
34 if (n & 4) {
35 vst1_u16(dst, vget_low_u16(v8));
36 dst += 4;
37 }
38 switch (n & 3) {
39 case 3: *dst++ = value;
40 case 2: *dst++ = value;
41 case 1: *dst = value;
42 }
43 }
44
45 static void memset32(uint32_t* dst, uint32_t value, int n) {
46 uint32x4_t v4 = vdupq_n_u32(value);
47 uint32x4x4_t v16 = {{ v4, v4, v4, v4 }};
48
49 while (n >= 16) {
50 vst4q_u32(dst, v16); // This swizzles, but we don't care: all lanes are the same, value.
51 dst += 16;
52 n -= 16;
53 }
54 switch (n / 4) {
55 case 3: vst1q_u32(dst, v4); dst += 4;
56 case 2: vst1q_u32(dst, v4); dst += 4;
57 case 1: vst1q_u32(dst, v4); dst += 4;
58 }
59 if (n & 2) {
60 vst1_u32(dst, vget_low_u32(v4));
61 dst += 2;
62 }
63 if (n & 1) {
64 *dst = value;
65 }
66 }
67
68 } // namespace neon
69
70 namespace SkOpts { 16 namespace SkOpts {
71 void Init_neon() { 17 void Init_neon() {
72 rsqrt = neon::rsqrt; 18 rsqrt = neon::rsqrt;
73 memset16 = neon::memset16; 19 memset16 = neon::memset16;
74 memset32 = neon::memset32; 20 memset32 = neon::memset32;
75 create_xfermode = SkCreate4pxXfermode; 21 create_xfermode = SkCreate4pxXfermode;
76 22
77 static const auto x = neon::kX, y = neon::kY; 23 static const auto x = neon::kX, y = neon::kY;
78 box_blur_xx = neon::box_blur<x,x>; 24 box_blur_xx = neon::box_blur<x,x>;
79 box_blur_xy = neon::box_blur<x,y>; 25 box_blur_xy = neon::box_blur<x,y>;
80 box_blur_yx = neon::box_blur<y,x>; 26 box_blur_yx = neon::box_blur<y,x>;
81 } 27 }
82 } 28 }
OLDNEW
« no previous file with comments | « src/opts/SkFloatingPoint_opts.h ('k') | src/opts/SkOpts_sse2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698