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

Side by Side Diff: crosstest/test_cast_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 | « crosstest/test_calling_conv.def ('k') | crosstest/test_fcmp_main.cpp » ('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_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
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
96 // TODO(jpp): remove this once vector support is implemented.
95 const static size_t NumElementsInType = Vectors<FromType>::NumElements; 97 const static size_t NumElementsInType = Vectors<FromType>::NumElements;
96 PRNG Index; 98 PRNG Index;
97 static const float NegInf = -1.0 / 0.0; 99 static const float NegInf = -1.0 / 0.0;
98 static const float PosInf = 1.0 / 0.0; 100 static const float PosInf = 1.0 / 0.0;
99 static const float Nan = 0.0 / 0.0; 101 static const float Nan = 0.0 / 0.0;
100 static const float NegNan = -0.0 / 0.0; 102 static const float NegNan = -0.0 / 0.0;
101 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); 103 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
102 static const size_t NumValues = sizeof(Values) / sizeof(*Values); 104 static const size_t NumValues = sizeof(Values) / sizeof(*Values);
103 const size_t MaxTestsPerFunc = 20000; 105 const size_t MaxTestsPerFunc = 20000;
104 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { 106 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
105 // Initialize the test vectors. 107 // Initialize the test vectors.
106 FromType Value; 108 FromType Value;
107 for (size_t j = 0; j < NumElementsInType; ++j) { 109 for (size_t j = 0; j < NumElementsInType; ++j) {
108 Value[j] = Values[Index() % NumValues]; 110 Value[j] = Values[Index() % NumValues];
109 } 111 }
110 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString); 112 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString);
111 } 113 }
114 #endif // ARM32
112 } 115 }
113 116
114 #ifdef X8664_STACK_HACK 117 #ifdef X8664_STACK_HACK
115 extern "C" int wrapped_main(int argc, char *argv[]) { 118 extern "C" int wrapped_main(int argc, char *argv[]) {
116 #else // !defined(X8664_STACK_HACK) 119 #else // !defined(X8664_STACK_HACK)
117 int main(int argc, char *argv[]) { 120 int main(int argc, char *argv[]) {
118 #endif // X8664_STACK_HACK 121 #endif // X8664_STACK_HACK
119 size_t TotalTests = 0; 122 size_t TotalTests = 0;
120 size_t Passes = 0; 123 size_t Passes = 0;
121 size_t Failures = 0; 124 size_t Failures = 0;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 239 }
237 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32"); 240 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32");
238 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32"); 241 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32");
239 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32"); 242 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32");
240 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32"); 243 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32");
241 244
242 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 245 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
243 << " Failures=" << Failures << "\n"; 246 << " Failures=" << Failures << "\n";
244 return Failures; 247 return Failures;
245 } 248 }
OLDNEW
« no previous file with comments | « crosstest/test_calling_conv.def ('k') | crosstest/test_fcmp_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698