aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-23 12:20:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-23 17:02:53 +0000
commit87db00111596d432908882a13982adde79793a7c (patch)
treef1eddaef5810ed9b6d72629508c6868fc6493c99 /src/opts
parent5373609d90d8f84b75718b15f3522f9d2f4226cb (diff)
move sk_memset?? to SkOpts
This lets the compiler generate AVX versions with wider writes. Change-Id: Ia63825e70c72bdb4d14bef97d8b4ea4be54c9d84 Reviewed-on: https://skia-review.googlesource.com/17715 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkOpts_avx.cpp11
-rw-r--r--src/opts/SkUtils_opts.h31
2 files changed, 39 insertions, 3 deletions
diff --git a/src/opts/SkOpts_avx.cpp b/src/opts/SkOpts_avx.cpp
index 06e46d9502..7e34330e1c 100644
--- a/src/opts/SkOpts_avx.cpp
+++ b/src/opts/SkOpts_avx.cpp
@@ -8,12 +8,17 @@
#include "SkSafe_math.h" // Keep this first.
#include "SkOpts.h"
-#define SK_OPTS_NS avx
-
#if defined(_INC_MATH) && !defined(INC_MATH_IS_SAFE_NOW)
#error We have included ucrt\math.h without protecting it against ODR violation.
#endif
+#define SK_OPTS_NS avx
+#include "SkUtils_opts.h"
+
namespace SkOpts {
- void Init_avx() { }
+ void Init_avx() {
+ memset16 = SK_OPTS_NS::memset16;
+ memset32 = SK_OPTS_NS::memset32;
+ memset64 = SK_OPTS_NS::memset64;
+ }
}
diff --git a/src/opts/SkUtils_opts.h b/src/opts/SkUtils_opts.h
new file mode 100644
index 0000000000..c9390af5cf
--- /dev/null
+++ b/src/opts/SkUtils_opts.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkUtils_opts_DEFINED
+#define SkUtils_opts_DEFINED
+
+namespace SK_OPTS_NS {
+
+ static void memset16(uint16_t buffer[], uint16_t value, int count) {
+ for (int i = 0; i < count; i++) {
+ buffer[i] = value;
+ }
+ }
+ static void memset32(uint32_t buffer[], uint32_t value, int count) {
+ for (int i = 0; i < count; i++) {
+ buffer[i] = value;
+ }
+ }
+ static void memset64(uint64_t buffer[], uint64_t value, int count) {
+ for (int i = 0; i < count; i++) {
+ buffer[i] = value;
+ }
+ }
+
+}
+
+#endif//SkUtils_opts_DEFINED