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

Side by Side Diff: tests/SkNxTest.cpp

Issue 1109913002: Split rsqrt into rsqrt{0,1,2}, with increasing cost and precision on ARM (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: arm64 typos Created 5 years, 7 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/SkNx_sse.h ('k') | no next file » | 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 "SkNx.h" 8 #include "SkNx.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 assert_eq(a+b, 6, 8, 10, 12); 43 assert_eq(a+b, 6, 8, 10, 12);
44 assert_eq(a*b, 9, 16, 25, 36); 44 assert_eq(a*b, 9, 16, 25, 36);
45 assert_eq(a*b-b, 6, 12, 20, 30); 45 assert_eq(a*b-b, 6, 12, 20, 30);
46 assert_eq((a*b).sqrt(), 3, 4, 5, 6); 46 assert_eq((a*b).sqrt(), 3, 4, 5, 6);
47 assert_eq(a/b, 1, 1, 1, 1); 47 assert_eq(a/b, 1, 1, 1, 1);
48 assert_eq(-a, -3, -4, -5, -6); 48 assert_eq(-a, -3, -4, -5, -6);
49 49
50 SkNf<N,T> fours(4); 50 SkNf<N,T> fours(4);
51 51
52 assert_eq(fours.sqrt(), 2,2,2,2); 52 assert_eq(fours.sqrt(), 2,2,2,2);
53 assert_nearly_eq(0.001, fours.rsqrt(), 0.5, 0.5, 0.5, 0.5); 53 assert_nearly_eq(0.001, fours.rsqrt0(), 0.5, 0.5, 0.5, 0.5);
54 assert_nearly_eq(0.001, fours.rsqrt1(), 0.5, 0.5, 0.5, 0.5);
55 assert_nearly_eq(0.001, fours.rsqrt2(), 0.5, 0.5, 0.5, 0.5);
54 56
55 assert_eq( fours. invert(), 0.25, 0.25, 0.25, 0.25); 57 assert_eq( fours. invert(), 0.25, 0.25, 0.25, 0.25);
56 assert_nearly_eq(0.001, fours.approxInvert(), 0.25, 0.25, 0.25, 0.25); 58 assert_nearly_eq(0.001, fours.approxInvert(), 0.25, 0.25, 0.25, 0.25);
57 59
58 assert_eq(SkNf<N,T>::Min(a, fours), 3, 4, 4, 4); 60 assert_eq(SkNf<N,T>::Min(a, fours), 3, 4, 4, 4);
59 assert_eq(SkNf<N,T>::Max(a, fours), 4, 4, 5, 6); 61 assert_eq(SkNf<N,T>::Max(a, fours), 4, 4, 5, 6);
60 62
61 // Test some comparisons. This is not exhaustive. 63 // Test some comparisons. This is not exhaustive.
62 REPORTER_ASSERT(r, (a == b).allTrue()); 64 REPORTER_ASSERT(r, (a == b).allTrue());
63 REPORTER_ASSERT(r, (a+b == a*b-b).anyTrue()); 65 REPORTER_ASSERT(r, (a+b == a*b-b).anyTrue());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 123
122 DEF_TEST(SkNi, r) { 124 DEF_TEST(SkNi, r) {
123 test_Ni<2, uint16_t>(r); 125 test_Ni<2, uint16_t>(r);
124 test_Ni<4, uint16_t>(r); 126 test_Ni<4, uint16_t>(r);
125 test_Ni<8, uint16_t>(r); 127 test_Ni<8, uint16_t>(r);
126 128
127 test_Ni<2, int>(r); 129 test_Ni<2, int>(r);
128 test_Ni<4, int>(r); 130 test_Ni<4, int>(r);
129 test_Ni<8, int>(r); 131 test_Ni<8, int>(r);
130 } 132 }
OLDNEW
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698