diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-08-28 14:45:40 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-28 21:21:36 +0000 |
commit | 7732f4f8f2536688164f45ac329f5268759b4b26 (patch) | |
tree | 3576f6e927373d3493eb489267a06ecdb2aff53a /tests | |
parent | 08133583d5e1cdfdcc41b4bb078fcfb64137f058 (diff) |
Add missing methods to neon/sse SkNx implementations
Adds negate, abs, sqrt to Sk2f and/or Sk4f.
Bug: skia:
Change-Id: I0688dae45b32ff94abcc0525ef1f09d666f9c6e9
Reviewed-on: https://skia-review.googlesource.com/39642
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkNxTest.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp index e3f3cd6f3f..240d7e001b 100644 --- a/tests/SkNxTest.cpp +++ b/tests/SkNxTest.cpp @@ -210,6 +210,12 @@ DEF_TEST(SkNx_abs, r) { REPORTER_ASSERT(r, fs[1] == 0.0f); REPORTER_ASSERT(r, fs[2] == 2.0f); REPORTER_ASSERT(r, fs[3] == 4.0f); + auto fshi = Sk2f(0.0f, -0.0f).abs(); + auto fslo = Sk2f(2.0f, -4.0f).abs(); + REPORTER_ASSERT(r, fshi[0] == 0.0f); + REPORTER_ASSERT(r, fshi[1] == 0.0f); + REPORTER_ASSERT(r, fslo[0] == 2.0f); + REPORTER_ASSERT(r, fslo[1] == 4.0f); } DEF_TEST(Sk4i_abs, r) { @@ -358,3 +364,31 @@ DEF_TEST(SkNx_4fLoad4Store4, r) { Sk4f::Store4(dst, a, b, c, d); REPORTER_ASSERT(r, 0 == memcmp(dst, src, 16 * sizeof(float))); } + +DEF_TEST(SkNx_neg, r) { + auto fs = -Sk4f(0.0f, -0.0f, 2.0f, -4.0f); + REPORTER_ASSERT(r, fs[0] == 0.0f); + REPORTER_ASSERT(r, fs[1] == 0.0f); + REPORTER_ASSERT(r, fs[2] == -2.0f); + REPORTER_ASSERT(r, fs[3] == 4.0f); + auto fshi = -Sk2f(0.0f, -0.0f); + auto fslo = -Sk2f(2.0f, -4.0f); + REPORTER_ASSERT(r, fshi[0] == 0.0f); + REPORTER_ASSERT(r, fshi[1] == 0.0f); + REPORTER_ASSERT(r, fslo[0] == -2.0f); + REPORTER_ASSERT(r, fslo[1] == 4.0f); +} + +DEF_TEST(SkNx_thenElse, r) { + auto fs = (Sk4f(0.0f, -0.0f, 2.0f, -4.0f) < 0).thenElse(-1, 1); + REPORTER_ASSERT(r, fs[0] == 1); + REPORTER_ASSERT(r, fs[1] == 1); + REPORTER_ASSERT(r, fs[2] == 1); + REPORTER_ASSERT(r, fs[3] == -1); + auto fshi = (Sk2f(0.0f, -0.0f) < 0).thenElse(-1, 1); + auto fslo = (Sk2f(2.0f, -4.0f) < 0).thenElse(-1, 1); + REPORTER_ASSERT(r, fshi[0] == 1); + REPORTER_ASSERT(r, fshi[1] == 1); + REPORTER_ASSERT(r, fslo[0] == 1); + REPORTER_ASSERT(r, fslo[1] == -1); +} |