OLD | NEW |
1 //===- subzero/crosstest/test_cast_main.cpp - Driver for tests ------------===// | 1 //===- subzero/crosstest/test_cast_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 cast operations. | 10 // Driver for crosstesting cast operations. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 COMPARE(cast, FromType, int32_t, Val, FromTypeString); | 85 COMPARE(cast, FromType, int32_t, Val, FromTypeString); |
86 COMPARE(cast, FromType, uint64, Val, FromTypeString); | 86 COMPARE(cast, FromType, uint64, Val, FromTypeString); |
87 COMPARE(cast, FromType, int64, Val, FromTypeString); | 87 COMPARE(cast, FromType, int64, Val, FromTypeString); |
88 COMPARE(cast, FromType, float, Val, FromTypeString); | 88 COMPARE(cast, FromType, float, Val, FromTypeString); |
89 COMPARE(cast, FromType, double, Val, FromTypeString); | 89 COMPARE(cast, FromType, double, Val, FromTypeString); |
90 } | 90 } |
91 | 91 |
92 template <typename FromType, typename ToType> | 92 template <typename FromType, typename ToType> |
93 void testVector(size_t &TotalTests, size_t &Passes, size_t &Failures, | 93 void testVector(size_t &TotalTests, size_t &Passes, size_t &Failures, |
94 const char *FromTypeString, const char *ToTypeString) { | 94 const char *FromTypeString, const char *ToTypeString) { |
| 95 #ifndef ARM32 |
95 const static size_t NumElementsInType = Vectors<FromType>::NumElements; | 96 const static size_t NumElementsInType = Vectors<FromType>::NumElements; |
96 PRNG Index; | 97 PRNG Index; |
97 static const float NegInf = -1.0 / 0.0; | 98 static const float NegInf = -1.0 / 0.0; |
98 static const float PosInf = 1.0 / 0.0; | 99 static const float PosInf = 1.0 / 0.0; |
99 static const float Nan = 0.0 / 0.0; | 100 static const float Nan = 0.0 / 0.0; |
100 static const float NegNan = -0.0 / 0.0; | 101 static const float NegNan = -0.0 / 0.0; |
101 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); | 102 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); |
102 static const size_t NumValues = sizeof(Values) / sizeof(*Values); | 103 static const size_t NumValues = sizeof(Values) / sizeof(*Values); |
103 const size_t MaxTestsPerFunc = 20000; | 104 const size_t MaxTestsPerFunc = 20000; |
104 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { | 105 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { |
105 // Initialize the test vectors. | 106 // Initialize the test vectors. |
106 FromType Value; | 107 FromType Value; |
107 for (size_t j = 0; j < NumElementsInType; ++j) { | 108 for (size_t j = 0; j < NumElementsInType; ++j) { |
108 Value[j] = Values[Index() % NumValues]; | 109 Value[j] = Values[Index() % NumValues]; |
109 } | 110 } |
110 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString); | 111 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString); |
111 } | 112 } |
| 113 #endif // ARM32 |
112 } | 114 } |
113 | 115 |
114 #ifdef X8664_STACK_HACK | 116 #ifdef X8664_STACK_HACK |
115 extern "C" int wrapped_main(int argc, char *argv[]) { | 117 extern "C" int wrapped_main(int argc, char *argv[]) { |
116 #else // !defined(X8664_STACK_HACK) | 118 #else // !defined(X8664_STACK_HACK) |
117 int main(int argc, char *argv[]) { | 119 int main(int argc, char *argv[]) { |
118 #endif // X8664_STACK_HACK | 120 #endif // X8664_STACK_HACK |
119 size_t TotalTests = 0; | 121 size_t TotalTests = 0; |
120 size_t Passes = 0; | 122 size_t Passes = 0; |
121 size_t Failures = 0; | 123 size_t Failures = 0; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 238 } |
237 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32"); | 239 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32"); |
238 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32"); | 240 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32"); |
239 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32"); | 241 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32"); |
240 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32"); | 242 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32"); |
241 | 243 |
242 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 244 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
243 << " Failures=" << Failures << "\n"; | 245 << " Failures=" << Failures << "\n"; |
244 return Failures; | 246 return Failures; |
245 } | 247 } |
OLD | NEW |