aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/MathTest.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2016-01-22 11:51:40 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-22 11:51:40 -0800
commited814f34c72248c7eecf3b0a5f335c3a7c2e9dd1 (patch)
tree4ab2b47a24d026555810c46f6cd21661c0cea8f2 /tests/MathTest.cpp
parent921d7ac75206740e69fc6bc9893971249a909fe1 (diff)
Revert of de-proc sk_float_rsqrt (patchset #3 id:40001 of https://codereview.chromium.org/1616013003/ )
Reason for revert: This is somehow blocking the Google3 roll in ways neither Ben nor I understand. Precautionary revert... will try again Monday. Original issue's description: > de-proc sk_float_rsqrt > > This is the first of many little baby steps to have us stop runtime-detecting NEON. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1616013003 > CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot > > Committed: https://skia.googlesource.com/skia/+/efcc125acd2d71eb077caf6db65fdd6b9eb1dc0d TBR=reed@google.com,mtklein@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1629503002
Diffstat (limited to 'tests/MathTest.cpp')
-rw-r--r--tests/MathTest.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index de7ad1db78..24e46f3097 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -382,15 +382,14 @@ static void unittest_half(skiatest::Reporter* reporter) {
}
-template <typename RSqrtFn>
-static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
+static void test_rsqrt(skiatest::Reporter* reporter) {
const float maxRelativeError = 6.50196699e-4f;
// test close to 0 up to 1
float input = 0.000001f;
for (int i = 0; i < 1000; ++i) {
float exact = 1.0f/sk_float_sqrt(input);
- float estimate = rsqrt(input);
+ float estimate = sk_float_rsqrt(input);
float relativeError = sk_float_abs(exact - estimate)/exact;
REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
input += 0.001f;
@@ -400,7 +399,7 @@ static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
input = 1.0f;
for (int i = 0; i < 1000; ++i) {
float exact = 1.0f/sk_float_sqrt(input);
- float estimate = rsqrt(input);
+ float estimate = sk_float_rsqrt(input);
float relativeError = sk_float_abs(exact - estimate)/exact;
REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
input += 0.01f;
@@ -410,7 +409,7 @@ static void test_rsqrt(skiatest::Reporter* reporter, RSqrtFn rsqrt) {
input = 1000000.0f;
for (int i = 0; i < 100; ++i) {
float exact = 1.0f/sk_float_sqrt(input);
- float estimate = rsqrt(input);
+ float estimate = sk_float_rsqrt(input);
float relativeError = sk_float_abs(exact - estimate)/exact;
REPORTER_ASSERT(reporter, relativeError <= maxRelativeError);
input += 754326.f;
@@ -556,8 +555,7 @@ DEF_TEST(Math, reporter) {
unittest_fastfloat(reporter);
unittest_isfinite(reporter);
unittest_half(reporter);
- test_rsqrt(reporter, sk_float_rsqrt);
- test_rsqrt(reporter, sk_float_rsqrt_portable);
+ test_rsqrt(reporter);
for (i = 0; i < 10000; i++) {
SkFixed numer = rand.nextS();