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

Side by Side Diff: tests/SkNxTest.cpp

Issue 1088883005: Sk4h and Sk8h for SSE (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 8 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 REPORTER_ASSERT(r, !(a >= fours).allTrue()); 70 REPORTER_ASSERT(r, !(a >= fours).allTrue());
71 } 71 }
72 72
73 DEF_TEST(SkNf, r) { 73 DEF_TEST(SkNf, r) {
74 test_Nf<2, float>(r); 74 test_Nf<2, float>(r);
75 test_Nf<2, double>(r); 75 test_Nf<2, double>(r);
76 76
77 test_Nf<4, float>(r); 77 test_Nf<4, float>(r);
78 test_Nf<4, double>(r); 78 test_Nf<4, double>(r);
79 } 79 }
80
81 template <int N, typename T>
82 void test_Ni(skiatest::Reporter* r) {
83 auto assert_eq = [&](const SkNi<N,T>& v, T a, T b, T c, T d, T e, T f, T g, T h) {
84 T vals[8];
85 v.store(vals);
86
87 switch (N) {
88 case 8: REPORTER_ASSERT(r, vals[4] == e && vals[5] == f && vals[6] == g && vals[7] == h);
89 case 4: REPORTER_ASSERT(r, vals[2] == c && vals[3] == d);
90 case 2: REPORTER_ASSERT(r, vals[0] == a && vals[1] == b);
91 }
92 };
93
94 T vals[] = { 1,2,3,4,5,6,7,8 };
95 SkNi<N,T> a = SkNi<N,T>::Load(vals),
96 b(a),
97 c = a;
98 SkNi<N,T> d;
99 d = a;
100
101 assert_eq(a, 1,2,3,4,5,6,7,8);
102 assert_eq(b, 1,2,3,4,5,6,7,8);
103 assert_eq(c, 1,2,3,4,5,6,7,8);
104 assert_eq(d, 1,2,3,4,5,6,7,8);
105
106 assert_eq(a+a, 2,4,6,8,10,12,14,16);
107 assert_eq(a*a, 1,4,9,16,25,36,49,64);
108 assert_eq(a*a-a, 0,2,6,12,20,30,42,56);
109
110 assert_eq(a >> 2, 0,0,0,1,1,1,1,2);
111 assert_eq(a << 1, 2,4,6,8,10,12,14,16);
112
113 REPORTER_ASSERT(r, a.template kth<1>() == 2);
114 }
115
116 DEF_TEST(SkNi, r) {
117 test_Ni<2, uint16_t>(r);
118 test_Ni<4, uint16_t>(r);
119 test_Ni<8, uint16_t>(r);
120 }
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