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

Side by Side Diff: tests/Sk4xTest.cpp

Issue 1029163002: Replace _mm_cvtps_epi32(x) with _mm_cvttps_epi32(_mm_add_ps(0.5f), x). (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: tweak test Created 5 years, 9 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 | « tests/PMFloatTest.cpp ('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 #include "Test.h" 1 #include "Test.h"
2 #include "Sk4x.h" 2 #include "Sk4x.h"
3 3
4 #define ASSERT_EQ(a, b) REPORTER_ASSERT(r, a.equal(b).allTrue()) 4 #define ASSERT_EQ(a, b) REPORTER_ASSERT(r, a.equal(b).allTrue())
5 #define ASSERT_NE(a, b) REPORTER_ASSERT(r, a.notEqual(b).allTrue()) 5 #define ASSERT_NE(a, b) REPORTER_ASSERT(r, a.notEqual(b).allTrue())
6 6
7 DEF_TEST(Sk4x_Construction, r) { 7 DEF_TEST(Sk4x_Construction, r) {
8 Sk4f uninitialized; 8 Sk4f uninitialized;
9 Sk4f zero(0,0,0,0); 9 Sk4f zero(0,0,0,0);
10 Sk4f foo(1,2,3,4), 10 Sk4f foo(1,2,3,4),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ASSERT_EQ(zeroi, zerof.reinterpret<Sk4i>()); 52 ASSERT_EQ(zeroi, zerof.reinterpret<Sk4i>());
53 ASSERT_EQ(zerof, zeroi.cast<Sk4f>()); 53 ASSERT_EQ(zerof, zeroi.cast<Sk4f>());
54 ASSERT_EQ(zerof, zeroi.reinterpret<Sk4f>()); 54 ASSERT_EQ(zerof, zeroi.reinterpret<Sk4f>());
55 55
56 Sk4f twof(2,2,2,2); 56 Sk4f twof(2,2,2,2);
57 Sk4i twoi(2,2,2,2); 57 Sk4i twoi(2,2,2,2);
58 ASSERT_EQ(twoi, twof.cast<Sk4i>()); 58 ASSERT_EQ(twoi, twof.cast<Sk4i>());
59 ASSERT_NE(twoi, twof.reinterpret<Sk4i>()); 59 ASSERT_NE(twoi, twof.reinterpret<Sk4i>());
60 ASSERT_EQ(twof, twoi.cast<Sk4f>()); 60 ASSERT_EQ(twof, twoi.cast<Sk4f>());
61 ASSERT_NE(twof, twoi.reinterpret<Sk4f>()); 61 ASSERT_NE(twof, twoi.reinterpret<Sk4f>());
62
63 ASSERT_EQ(Sk4i(0,0,0,0), Sk4f(0.5f, 0.49f, 0.51f, 0.99f).cast<Sk4i>());
64 ASSERT_EQ(Sk4i(1,1,1,1), Sk4f(1.5f, 1.49f, 1.51f, 1.99f).cast<Sk4i>());
62 } 65 }
63 66
64 DEF_TEST(Sk4x_Bits, r) { 67 DEF_TEST(Sk4x_Bits, r) {
65 ASSERT_EQ(Sk4i(0,0,0,0).bitNot(), Sk4i(-1,-1,-1,-1)); 68 ASSERT_EQ(Sk4i(0,0,0,0).bitNot(), Sk4i(-1,-1,-1,-1));
66 69
67 Sk4i a(2,3,4,5), 70 Sk4i a(2,3,4,5),
68 b(1,3,5,7); 71 b(1,3,5,7);
69 ASSERT_EQ(Sk4i(0,3,4,5), a & b); 72 ASSERT_EQ(Sk4i(0,3,4,5), a & b);
70 ASSERT_EQ(Sk4i(3,3,5,7), a | b); 73 ASSERT_EQ(Sk4i(3,3,5,7), a | b);
71 } 74 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 135 }
133 136
134 DEF_TEST(Sk4x_Swizzle, r) { 137 DEF_TEST(Sk4x_Swizzle, r) {
135 ASSERT_EQ(Sk4f(3,4,1,2), Sk4f(1,2,3,4).zwxy()); 138 ASSERT_EQ(Sk4f(3,4,1,2), Sk4f(1,2,3,4).zwxy());
136 ASSERT_EQ(Sk4f(1,2,5,6), Sk4f::XYAB(Sk4f(1,2,3,4), Sk4f(5,6,7,8))); 139 ASSERT_EQ(Sk4f(1,2,5,6), Sk4f::XYAB(Sk4f(1,2,3,4), Sk4f(5,6,7,8)));
137 ASSERT_EQ(Sk4f(3,4,7,8), Sk4f::ZWCD(Sk4f(1,2,3,4), Sk4f(5,6,7,8))); 140 ASSERT_EQ(Sk4f(3,4,7,8), Sk4f::ZWCD(Sk4f(1,2,3,4), Sk4f(5,6,7,8)));
138 ASSERT_EQ(Sk4i(3,4,1,2), Sk4i(1,2,3,4).zwxy()); 141 ASSERT_EQ(Sk4i(3,4,1,2), Sk4i(1,2,3,4).zwxy());
139 ASSERT_EQ(Sk4i(1,2,5,6), Sk4i::XYAB(Sk4i(1,2,3,4), Sk4i(5,6,7,8))); 142 ASSERT_EQ(Sk4i(1,2,5,6), Sk4i::XYAB(Sk4i(1,2,3,4), Sk4i(5,6,7,8)));
140 ASSERT_EQ(Sk4i(3,4,7,8), Sk4i::ZWCD(Sk4i(1,2,3,4), Sk4i(5,6,7,8))); 143 ASSERT_EQ(Sk4i(3,4,7,8), Sk4i::ZWCD(Sk4i(1,2,3,4), Sk4i(5,6,7,8)));
141 } 144 }
OLDNEW
« no previous file with comments | « tests/PMFloatTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698