| 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 #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[]) { | 28 int main(int argc, char *argv[]) { |
| 32 #endif // X8664_STACK_HACK | |
| 33 size_t TotalTests = 0; | 29 size_t TotalTests = 0; |
| 34 size_t Passes = 0; | 30 size_t Passes = 0; |
| 35 size_t Failures = 0; | 31 size_t Failures = 0; |
| 36 static int32_t Values[] = {-100, -50, 0, 1, 8, 123, 0x33333333, 0x77777777}; | 32 static int32_t Values[] = {-100, -50, 0, 1, 8, 123, 0x33333333, 0x77777777}; |
| 37 for (size_t i = 0; i < sizeof(Values) / sizeof(*Values); ++i) { | 33 for (size_t i = 0; i < sizeof(Values) / sizeof(*Values); ++i) { |
| 38 int32_t SVal = Values[i]; | 34 int32_t SVal = Values[i]; |
| 39 int32_t ResultLlcS, ResultSzS; | 35 int32_t ResultLlcS, ResultSzS; |
| 40 uint32_t UVal = (uint32_t)Values[i]; | 36 uint32_t UVal = (uint32_t)Values[i]; |
| 41 int32_t ResultLlcU, ResultSzU; | 37 int32_t ResultLlcU, ResultSzU; |
| 42 | 38 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 << "): sz=" << ResultSzU << " llc=" << ResultLlcU << "\n"; \ | 56 << "): sz=" << ResultSzU << " llc=" << ResultLlcU << "\n"; \ |
| 61 } | 57 } |
| 62 CONST_TABLE | 58 CONST_TABLE |
| 63 #undef X | 59 #undef X |
| 64 } | 60 } |
| 65 | 61 |
| 66 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 62 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
| 67 << " Failures=" << Failures << "\n"; | 63 << " Failures=" << Failures << "\n"; |
| 68 return Failures; | 64 return Failures; |
| 69 } | 65 } |
| OLD | NEW |