| OLD | NEW |
| 1 //===- subzero/crosstest/test_strengthreduce_main.cpp - Driver for tests --===// | 1 //===- subzero/crosstest/test_strengthreduce_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 strength-reducing optimizations. | 10 // Driver for crosstesting arithmetic strength-reducing optimizations. |
| 11 // | 11 // |
| 12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
| 13 | 13 |
| 14 /* crosstest.py --test=test_strengthreduce.cpp \ | 14 /* crosstest.py --test=test_strengthreduce.cpp \ |
| 15 --driver=test_strengthreduce_main.cpp \ | 15 --driver=test_strengthreduce_main.cpp \ |
| 16 --prefix=Subzero_ --clang-opt=0 --output=test_strengthreduce */ | 16 --prefix=Subzero_ --clang-opt=0 --output=test_strengthreduce */ |
| 17 | 17 |
| 18 #include <iostream> | 18 #include <iostream> |
| 19 | 19 |
| 20 // Include test_strengthreduce.h twice - once normally, and once | 20 // Include test_strengthreduce.h twice - once normally, and once |
| 21 // within the Subzero_ namespace, corresponding to the llc and Subzero | 21 // within the Subzero_ namespace, corresponding to the llc and Subzero |
| 22 // translated object files, respectively. | 22 // translated object files, respectively. |
| 23 #include "test_strengthreduce.h" | 23 #include "test_strengthreduce.h" |
| 24 namespace Subzero_ { | 24 namespace Subzero_ { |
| 25 #include "test_strengthreduce.h" | 25 #include "test_strengthreduce.h" |
| 26 } | 26 } |
| 27 | 27 |
| 28 int main(int argc, char **argv) { | 28 #ifdef X8664_STACK_HACK |
| 29 extern "C" int wrapped_main(int argc, char *argv[]) { |
| 30 #else // !defined(X8664_STACK_HACK) |
| 31 int main(int argc, char *argv[]) { |
| 32 #endif // X8664_STACK_HACK |
| 29 size_t TotalTests = 0; | 33 size_t TotalTests = 0; |
| 30 size_t Passes = 0; | 34 size_t Passes = 0; |
| 31 size_t Failures = 0; | 35 size_t Failures = 0; |
| 32 static int32_t Values[] = {-100, -50, 0, 1, 8, 123, 0x33333333, 0x77777777}; | 36 static int32_t Values[] = {-100, -50, 0, 1, 8, 123, 0x33333333, 0x77777777}; |
| 33 for (size_t i = 0; i < sizeof(Values) / sizeof(*Values); ++i) { | 37 for (size_t i = 0; i < sizeof(Values) / sizeof(*Values); ++i) { |
| 34 int32_t SVal = Values[i]; | 38 int32_t SVal = Values[i]; |
| 35 int32_t ResultLlcS, ResultSzS; | 39 int32_t ResultLlcS, ResultSzS; |
| 36 uint32_t UVal = (uint32_t)Values[i]; | 40 uint32_t UVal = (uint32_t)Values[i]; |
| 37 int32_t ResultLlcU, ResultSzU; | 41 int32_t ResultLlcU, ResultSzU; |
| 38 | 42 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 56 << "): sz=" << ResultSzU << " llc=" << ResultLlcU << "\n"; \ | 60 << "): sz=" << ResultSzU << " llc=" << ResultLlcU << "\n"; \ |
| 57 } | 61 } |
| 58 CONST_TABLE | 62 CONST_TABLE |
| 59 #undef X | 63 #undef X |
| 60 } | 64 } |
| 61 | 65 |
| 62 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 66 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
| 63 << " Failures=" << Failures << "\n"; | 67 << " Failures=" << Failures << "\n"; |
| 64 return Failures; | 68 return Failures; |
| 65 } | 69 } |
| OLD | NEW |