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

Side by Side Diff: crosstest/test_arith_main.cpp

Issue 1273153002: Subzero. Native 64-bit int arithmetic on x86-64. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes tests & make format Created 5 years, 4 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/test_arith.cpp ('k') | crosstest/test_bitmanip.def » ('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 10 matching lines...) Expand all
21 #include <limits> 21 #include <limits>
22 #include <cfloat> 22 #include <cfloat>
23 #include <cmath> // fmodf 23 #include <cmath> // fmodf
24 #include <cstring> // memcmp 24 #include <cstring> // memcmp
25 #include <iostream> 25 #include <iostream>
26 26
27 // Include test_arith.h twice - once normally, and once within the 27 // Include test_arith.h twice - once normally, and once within the
28 // Subzero_ namespace, corresponding to the llc and Subzero translated 28 // Subzero_ namespace, corresponding to the llc and Subzero translated
29 // object files, respectively. 29 // object files, respectively.
30 #include "test_arith.h" 30 #include "test_arith.h"
31 #include "xdefs.h"
32
31 namespace Subzero_ { 33 namespace Subzero_ {
32 #include "test_arith.h" 34 #include "test_arith.h"
33 } 35 }
34 36
35 template <class T> bool inputsMayTriggerException(T Value1, T Value2) { 37 template <class T> bool inputsMayTriggerException(T Value1, T Value2) {
36 // Avoid HW divide-by-zero exception. 38 // Avoid HW divide-by-zero exception.
37 if (Value2 == 0) 39 if (Value2 == 0)
38 return true; 40 return true;
39 // Avoid HW overflow exception (on x86-32). TODO: adjust 41 // Avoid HW overflow exception (on x86-32). TODO: adjust
40 // for other architecture. 42 // for other architecture.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 ++Failures; 358 ++Failures;
357 std::cout << "test_fabs_v4f32" 359 std::cout << "test_fabs_v4f32"
358 << "(" << vectAsString<v4f32>(Value1) 360 << "(" << vectAsString<v4f32>(Value1)
359 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc" 361 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
360 << vectAsString<v4f32>(ResultLlc) << "\n"; 362 << vectAsString<v4f32>(ResultLlc) << "\n";
361 } 363 }
362 } 364 }
363 } 365 }
364 } 366 }
365 367
366 int main(int argc, char **argv) { 368 #ifdef X8664_STACK_HACK
369 extern "C" int wrapped_main(int argc, char *argv[]) {
370 #else // !defined(X8664_STACK_HACK)
371 int main(int argc, char *argv[]) {
372 #endif // X8664_STACK_HACK
367 size_t TotalTests = 0; 373 size_t TotalTests = 0;
368 size_t Passes = 0; 374 size_t Passes = 0;
369 size_t Failures = 0; 375 size_t Failures = 0;
370 376
371 testsInt<bool, bool>(TotalTests, Passes, Failures); 377 testsInt<bool, bool>(TotalTests, Passes, Failures);
372 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); 378 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures);
373 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); 379 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures);
374 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); 380 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures);
375 testsInt<uint64_t, int64_t>(TotalTests, Passes, Failures); 381 testsInt<uint64, int64>(TotalTests, Passes, Failures);
376 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); 382 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures);
377 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); 383 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
378 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); 384 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
379 testsFp<float>(TotalTests, Passes, Failures); 385 testsFp<float>(TotalTests, Passes, Failures);
380 testsFp<double>(TotalTests, Passes, Failures); 386 testsFp<double>(TotalTests, Passes, Failures);
381 testsVecFp(TotalTests, Passes, Failures); 387 testsVecFp(TotalTests, Passes, Failures);
382 388
383 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 389 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
384 << " Failures=" << Failures << "\n"; 390 << " Failures=" << Failures << "\n";
385 return Failures; 391 return Failures;
386 } 392 }
OLDNEW
« no previous file with comments | « crosstest/test_arith.cpp ('k') | crosstest/test_bitmanip.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698