aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-03-10 11:34:53 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-14 02:38:52 +0000
commitd8853ec0fd01ecd45c225aee1f22b3d342dcacd7 (patch)
tree671a3ec019016f1f42565b7f99ab3ecf9e140a60 /tests
parentba321b601782b4dd7cd060506dcc222ccdaac408 (diff)
exact divide by 255 with NEON
Change-Id: Ib121eb0d5af1f22f48f517fe909112a77d92032e Reviewed-on: https://skia-review.googlesource.com/113666 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/MathTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 94b15207f7..565f76f819 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -750,3 +750,23 @@ DEF_TEST(DoubleSaturate32, reporter) {
REPORTER_ASSERT(reporter, r.fExpectedInt == i);
}
}
+
+#if defined(__ARM_NEON)
+ #include <arm_neon.h>
+
+ DEF_TEST(NeonU16Div255, r) {
+
+ for (int v = 0; v <= 255*255; v++) {
+ int want = (v + 127)/255;
+
+ uint16x8_t V = vdupq_n_u16(v);
+ int got = vrshrq_n_u16(vrsraq_n_u16(V, V, 8), 8)[0];
+
+ if (got != want) {
+ SkDebugf("%d -> %d, want %d\n", v, got, want);
+ }
+ REPORTER_ASSERT(r, got == want);
+ }
+ }
+
+#endif