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

Side by Side Diff: crosstest/test_arith_main.cpp

Issue 1359193003: Subzero. Enables (most) crosstests for ARM32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 5 years, 2 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 | « Makefile.standalone ('k') | crosstest/test_calling_conv.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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } else { 132 } else {
133 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2); 133 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2);
134 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2); 134 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2);
135 } 135 }
136 if (ResultSz == ResultLlc) { 136 if (ResultSz == ResultLlc) {
137 ++Passes; 137 ++Passes;
138 } else { 138 } else {
139 ++Failures; 139 ++Failures;
140 std::cout << "test" << Funcs[f].Name 140 std::cout << "test" << Funcs[f].Name
141 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1 141 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1
142 << ", " << Value2 << "): sz=" << (unsigned)ResultSz 142 << ", " << Value2 << "): sz=" << (uint64)ResultSz
143 << " llc=" << (unsigned)ResultLlc << "\n"; 143 << " llc=" << (uint64)ResultLlc << "\n";
144 } 144 }
145 } 145 }
146 } 146 }
147 } 147 }
148 } 148 }
149 } 149 }
150 } 150 }
151 } 151 }
152 152
153 const static size_t MaxTestsPerFunc = 100000; 153 const static size_t MaxTestsPerFunc = 100000;
154 154
155 template <typename TypeUnsignedLabel, typename TypeSignedLabel> 155 template <typename TypeUnsignedLabel, typename TypeSignedLabel>
156 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { 156 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
157 #ifndef ARM32
158 // TODO(jpp): remove this once vector support is implemented.
157 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; 159 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned;
158 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; 160 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned;
159 typedef typename Vectors<TypeUnsignedLabel>::ElementTy ElementTypeUnsigned; 161 typedef typename Vectors<TypeUnsignedLabel>::ElementTy ElementTypeUnsigned;
160 typedef typename Vectors<TypeSignedLabel>::ElementTy ElementTypeSigned; 162 typedef typename Vectors<TypeSignedLabel>::ElementTy ElementTypeSigned;
161 163
162 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); 164 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned);
163 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); 165 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned);
164 volatile unsigned Values[] = INT_VALUE_ARRAY; 166 volatile unsigned Values[] = INT_VALUE_ARRAY;
165 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 167 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
166 static struct { 168 static struct {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 std::cout << "test" << Funcs[f].Name << "v" << NumElementsInType << "i" 225 std::cout << "test" << Funcs[f].Name << "v" << NumElementsInType << "i"
224 << (CHAR_BIT * sizeof(ElementTypeUnsigned)) << "(" 226 << (CHAR_BIT * sizeof(ElementTypeUnsigned)) << "("
225 << vectAsString<TypeUnsignedLabel>(Value1) << "," 227 << vectAsString<TypeUnsignedLabel>(Value1) << ","
226 << vectAsString<TypeUnsignedLabel>(Value2) 228 << vectAsString<TypeUnsignedLabel>(Value2)
227 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) 229 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz)
228 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) 230 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc)
229 << "\n"; 231 << "\n";
230 } 232 }
231 } 233 }
232 } 234 }
235 #endif // ARM32
233 } 236 }
234 237
235 template <typename Type> 238 template <typename Type>
236 void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { 239 void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
237 static const Type NegInf = -1.0 / 0.0; 240 static const Type NegInf = -1.0 / 0.0;
238 static const Type PosInf = 1.0 / 0.0; 241 static const Type PosInf = 1.0 / 0.0;
239 static const Type Nan = 0.0 / 0.0; 242 static const Type Nan = 0.0 / 0.0;
240 static const Type NegNan = -0.0 / 0.0; 243 static const Type NegNan = -0.0 / 0.0;
241 volatile Type Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); 244 volatile Type Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
242 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 245 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } else { 301 } else {
299 ++Failures; 302 ++Failures;
300 std::cout << std::fixed << "test_fabs" << (CHAR_BIT * sizeof(Type)) << "(" 303 std::cout << std::fixed << "test_fabs" << (CHAR_BIT * sizeof(Type)) << "("
301 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc 304 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc
302 << "\n"; 305 << "\n";
303 } 306 }
304 } 307 }
305 } 308 }
306 309
307 void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { 310 void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
311 #ifndef ARM32
312 // TODO(jpp): remove this once vector support is implemented.
308 static const float NegInf = -1.0 / 0.0; 313 static const float NegInf = -1.0 / 0.0;
309 static const float PosInf = 1.0 / 0.0; 314 static const float PosInf = 1.0 / 0.0;
310 static const float Nan = 0.0 / 0.0; 315 static const float Nan = 0.0 / 0.0;
311 static const float NegNan = -0.0 / 0.0; 316 static const float NegNan = -0.0 / 0.0;
312 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); 317 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
313 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 318 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
314 typedef v4f32 (*FuncType)(v4f32, v4f32); 319 typedef v4f32 (*FuncType)(v4f32, v4f32);
315 static struct { 320 static struct {
316 const char *Name; 321 const char *Name;
317 FuncType FuncLlc; 322 FuncType FuncLlc;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 ++Passes; 361 ++Passes;
357 } else { 362 } else {
358 ++Failures; 363 ++Failures;
359 std::cout << "test_fabs_v4f32" 364 std::cout << "test_fabs_v4f32"
360 << "(" << vectAsString<v4f32>(Value1) 365 << "(" << vectAsString<v4f32>(Value1)
361 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc" 366 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
362 << vectAsString<v4f32>(ResultLlc) << "\n"; 367 << vectAsString<v4f32>(ResultLlc) << "\n";
363 } 368 }
364 } 369 }
365 } 370 }
371 #endif // ARM32
366 } 372 }
367 373
368 #ifdef X8664_STACK_HACK 374 #ifdef X8664_STACK_HACK
369 extern "C" int wrapped_main(int argc, char *argv[]) { 375 extern "C" int wrapped_main(int argc, char *argv[]) {
370 #else // !defined(X8664_STACK_HACK) 376 #else // !defined(X8664_STACK_HACK)
371 int main(int argc, char *argv[]) { 377 int main(int argc, char *argv[]) {
372 #endif // X8664_STACK_HACK 378 #endif // X8664_STACK_HACK
373 size_t TotalTests = 0; 379 size_t TotalTests = 0;
374 size_t Passes = 0; 380 size_t Passes = 0;
375 size_t Failures = 0; 381 size_t Failures = 0;
376 382
377 testsInt<bool, bool>(TotalTests, Passes, Failures); 383 testsInt<bool, bool>(TotalTests, Passes, Failures);
378 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); 384 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures);
379 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); 385 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures);
380 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); 386 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures);
381 testsInt<uint64, int64>(TotalTests, Passes, Failures); 387 testsInt<uint64, int64>(TotalTests, Passes, Failures);
382 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); 388 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures);
383 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); 389 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
384 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); 390 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
385 testsFp<float>(TotalTests, Passes, Failures); 391 testsFp<float>(TotalTests, Passes, Failures);
386 testsFp<double>(TotalTests, Passes, Failures); 392 testsFp<double>(TotalTests, Passes, Failures);
387 testsVecFp(TotalTests, Passes, Failures); 393 testsVecFp(TotalTests, Passes, Failures);
388 394
389 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 395 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
390 << " Failures=" << Failures << "\n"; 396 << " Failures=" << Failures << "\n";
391 return Failures; 397 return Failures;
392 } 398 }
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | crosstest/test_calling_conv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698