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

Side by Side Diff: crosstest/test_arith_main.cpp

Issue 877003003: Subzero: Use a "known" version of clang-format. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a clang-format blacklist. Fix formatting "errors". Created 5 years, 10 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 | « crosstest/mem_intrin_main.cpp ('k') | crosstest/test_bitmanip.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/crosstest/test_arith_main.cpp - Driver for tests -----------===// 1 //===- subzero/crosstest/test_arith_main.cpp - Driver for tests -----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // Driver for crosstesting arithmetic operations 10 // Driver for crosstesting arithmetic operations
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const char *Name; 57 const char *Name;
58 FuncTypeUnsigned FuncLlcUnsigned; 58 FuncTypeUnsigned FuncLlcUnsigned;
59 FuncTypeUnsigned FuncSzUnsigned; 59 FuncTypeUnsigned FuncSzUnsigned;
60 FuncTypeSigned FuncLlcSigned; 60 FuncTypeSigned FuncLlcSigned;
61 FuncTypeSigned FuncSzSigned; 61 FuncTypeSigned FuncSzSigned;
62 bool ExcludeDivExceptions; // for divide related tests 62 bool ExcludeDivExceptions; // for divide related tests
63 } Funcs[] = { 63 } Funcs[] = {
64 #define X(inst, op, isdiv, isshift) \ 64 #define X(inst, op, isdiv, isshift) \
65 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \ 65 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \
66 , 66 ,
67 UINTOP_TABLE 67 UINTOP_TABLE
68 #undef X 68 #undef X
69 #define X(inst, op, isdiv, isshift) \ 69 #define X(inst, op, isdiv, isshift) \
70 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \ 70 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \
71 , 71 ,
72 SINTOP_TABLE 72 SINTOP_TABLE
73 #undef X 73 #undef X
74 }; 74 };
75 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); 75 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
76 76
77 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) { 77 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) {
78 // This is the "normal" version of the loop nest, for 32-bit or 78 // This is the "normal" version of the loop nest, for 32-bit or
79 // narrower types. 79 // narrower types.
80 for (size_t f = 0; f < NumFuncs; ++f) { 80 for (size_t f = 0; f < NumFuncs; ++f) {
81 for (size_t i = 0; i < NumValues; ++i) { 81 for (size_t i = 0; i < NumValues; ++i) {
82 for (size_t j = 0; j < NumValues; ++j) { 82 for (size_t j = 0; j < NumValues; ++j) {
83 TypeUnsigned Value1 = Values[i]; 83 TypeUnsigned Value1 = Values[i];
84 TypeUnsigned Value2 = Values[j]; 84 TypeUnsigned Value2 = Values[j];
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // FuncSzUnsigned fields are NULL. 168 // FuncSzUnsigned fields are NULL.
169 const char *Name; 169 const char *Name;
170 FuncTypeUnsigned FuncLlcUnsigned; 170 FuncTypeUnsigned FuncLlcUnsigned;
171 FuncTypeUnsigned FuncSzUnsigned; 171 FuncTypeUnsigned FuncSzUnsigned;
172 FuncTypeSigned FuncLlcSigned; 172 FuncTypeSigned FuncLlcSigned;
173 FuncTypeSigned FuncSzSigned; 173 FuncTypeSigned FuncSzSigned;
174 bool ExcludeDivExceptions; // for divide related tests 174 bool ExcludeDivExceptions; // for divide related tests
175 bool MaskShiftOperations; // for shift related tests 175 bool MaskShiftOperations; // for shift related tests
176 } Funcs[] = { 176 } Funcs[] = {
177 #define X(inst, op, isdiv, isshift) \ 177 #define X(inst, op, isdiv, isshift) \
178 { \ 178 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv, isshift } \
179 STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv, isshift \
180 } \
181 , 179 ,
182 UINTOP_TABLE 180 UINTOP_TABLE
183 #undef X 181 #undef X
184 #define X(inst, op, isdiv, isshift) \ 182 #define X(inst, op, isdiv, isshift) \
185 { \ 183 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv, isshift } \
186 STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv, isshift \
187 } \
188 , 184 ,
189 SINTOP_TABLE 185 SINTOP_TABLE
190 #undef X 186 #undef X
191 }; 187 };
192 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); 188 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
193 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements; 189 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements;
194 for (size_t f = 0; f < NumFuncs; ++f) { 190 for (size_t f = 0; f < NumFuncs; ++f) {
195 PRNG Index; 191 PRNG Index;
196 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { 192 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
197 // Initialize the test vectors. 193 // Initialize the test vectors.
198 TypeUnsigned Value1, Value2; 194 TypeUnsigned Value1, Value2;
199 for (size_t j = 0; j < NumElementsInType;) { 195 for (size_t j = 0; j < NumElementsInType;) {
200 ElementTypeUnsigned Element1 = Values[Index() % NumValues]; 196 ElementTypeUnsigned Element1 = Values[Index() % NumValues];
201 ElementTypeUnsigned Element2 = Values[Index() % NumValues]; 197 ElementTypeUnsigned Element2 = Values[Index() % NumValues];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 240 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
245 typedef Type (*FuncType)(Type, Type); 241 typedef Type (*FuncType)(Type, Type);
246 static struct { 242 static struct {
247 const char *Name; 243 const char *Name;
248 FuncType FuncLlc; 244 FuncType FuncLlc;
249 FuncType FuncSz; 245 FuncType FuncSz;
250 } Funcs[] = { 246 } Funcs[] = {
251 #define X(inst, op, func) \ 247 #define X(inst, op, func) \
252 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \ 248 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \
253 , 249 ,
254 FPOP_TABLE 250 FPOP_TABLE
255 #undef X 251 #undef X
256 }; 252 };
257 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); 253 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
258 254
259 for (size_t f = 0; f < NumFuncs; ++f) { 255 for (size_t f = 0; f < NumFuncs; ++f) {
260 for (size_t i = 0; i < NumValues; ++i) { 256 for (size_t i = 0; i < NumValues; ++i) {
261 for (size_t j = 0; j < NumValues; ++j) { 257 for (size_t j = 0; j < NumValues; ++j) {
262 Type Value1 = Values[i]; 258 Type Value1 = Values[i];
263 Type Value2 = Values[j]; 259 Type Value2 = Values[j];
264 ++TotalTests; 260 ++TotalTests;
265 Type ResultSz = Funcs[f].FuncSz(Value1, Value2); 261 Type ResultSz = Funcs[f].FuncSz(Value1, Value2);
266 Type ResultLlc = Funcs[f].FuncLlc(Value1, Value2); 262 Type ResultLlc = Funcs[f].FuncLlc(Value1, Value2);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 299 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
304 typedef v4f32 (*FuncType)(v4f32, v4f32); 300 typedef v4f32 (*FuncType)(v4f32, v4f32);
305 static struct { 301 static struct {
306 const char *Name; 302 const char *Name;
307 FuncType FuncLlc; 303 FuncType FuncLlc;
308 FuncType FuncSz; 304 FuncType FuncSz;
309 } Funcs[] = { 305 } Funcs[] = {
310 #define X(inst, op, func) \ 306 #define X(inst, op, func) \
311 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \ 307 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \
312 , 308 ,
313 FPOP_TABLE 309 FPOP_TABLE
314 #undef X 310 #undef X
315 }; 311 };
316 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); 312 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
317 const static size_t NumElementsInType = 4; 313 const static size_t NumElementsInType = 4;
318 for (size_t f = 0; f < NumFuncs; ++f) { 314 for (size_t f = 0; f < NumFuncs; ++f) {
319 PRNG Index; 315 PRNG Index;
320 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { 316 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
321 // Initialize the test vectors. 317 // Initialize the test vectors.
322 v4f32 Value1, Value2; 318 v4f32 Value1, Value2;
323 for (size_t j = 0; j < NumElementsInType; ++j) { 319 for (size_t j = 0; j < NumElementsInType; ++j) {
324 Value1[j] = Values[Index() % NumValues]; 320 Value1[j] = Values[Index() % NumValues];
325 Value2[j] = Values[Index() % NumValues]; 321 Value2[j] = Values[Index() % NumValues];
(...skipping 30 matching lines...) Expand all
356 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); 352 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
357 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); 353 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
358 testsFp<float>(TotalTests, Passes, Failures); 354 testsFp<float>(TotalTests, Passes, Failures);
359 testsFp<double>(TotalTests, Passes, Failures); 355 testsFp<double>(TotalTests, Passes, Failures);
360 testsVecFp(TotalTests, Passes, Failures); 356 testsVecFp(TotalTests, Passes, Failures);
361 357
362 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 358 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
363 << " Failures=" << Failures << "\n"; 359 << " Failures=" << Failures << "\n";
364 return Failures; 360 return Failures;
365 } 361 }
366
OLDNEW
« no previous file with comments | « crosstest/mem_intrin_main.cpp ('k') | crosstest/test_bitmanip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698