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

Side by Side Diff: crosstest/test_cast_main.cpp

Issue 1708903002: Subzero. ARM32. Enable more crosstests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove the rest of the #ifdef ARM32. Created 4 years, 10 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.cpp ('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.
97 const static size_t NumElementsInType = Vectors<FromType>::NumElements; 95 const static size_t NumElementsInType = Vectors<FromType>::NumElements;
98 PRNG Index; 96 PRNG Index;
99 static const float NegInf = -1.0 / 0.0; 97 static const float NegInf = -1.0 / 0.0;
100 static const float PosInf = 1.0 / 0.0; 98 static const float PosInf = 1.0 / 0.0;
101 static const float Nan = 0.0 / 0.0; 99 static const float Nan = 0.0 / 0.0;
102 static const float NegNan = -0.0 / 0.0; 100 static const float NegNan = -0.0 / 0.0;
103 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); 101 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
104 static const size_t NumValues = sizeof(Values) / sizeof(*Values); 102 static const size_t NumValues = sizeof(Values) / sizeof(*Values);
105 const size_t MaxTestsPerFunc = 20000; 103 const size_t MaxTestsPerFunc = 20000;
106 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { 104 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
107 // Initialize the test vectors. 105 // Initialize the test vectors.
108 FromType Value; 106 FromType Value;
109 for (size_t j = 0; j < NumElementsInType; ++j) { 107 for (size_t j = 0; j < NumElementsInType; ++j) {
110 Value[j] = Values[Index() % NumValues]; 108 Value[j] = Values[Index() % NumValues];
111 } 109 }
112 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString); 110 COMPARE_VEC(cast, FromType, ToType, Value, FromTypeString, ToTypeString);
113 } 111 }
114 #endif // ARM32
115 } 112 }
116 113
117 int main(int argc, char *argv[]) { 114 int main(int argc, char *argv[]) {
118 size_t TotalTests = 0; 115 size_t TotalTests = 0;
119 size_t Passes = 0; 116 size_t Passes = 0;
120 size_t Failures = 0; 117 size_t Failures = 0;
121 118
122 volatile bool ValsUi1[] = {false, true}; 119 volatile bool ValsUi1[] = {false, true};
123 static const size_t NumValsUi1 = sizeof(ValsUi1) / sizeof(*ValsUi1); 120 static const size_t NumValsUi1 = sizeof(ValsUi1) / sizeof(*ValsUi1);
124 volatile uint8_t ValsUi8[] = {0, 1, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff}; 121 volatile uint8_t ValsUi8[] = {0, 1, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff};
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 232 }
236 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32"); 233 testVector<v4ui32, v4f32>(TotalTests, Passes, Failures, "v4ui32", "v4f32");
237 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32"); 234 testVector<v4si32, v4f32>(TotalTests, Passes, Failures, "v4si32", "v4f32");
238 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32"); 235 testVector<v4f32, v4si32>(TotalTests, Passes, Failures, "v4f32", "v4si32");
239 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32"); 236 testVector<v4f32, v4ui32>(TotalTests, Passes, Failures, "v4f32", "v4ui32");
240 237
241 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 238 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
242 << " Failures=" << Failures << "\n"; 239 << " Failures=" << Failures << "\n";
243 return Failures; 240 return Failures;
244 } 241 }
OLDNEW
« no previous file with comments | « crosstest/test_calling_conv.cpp ('k') | crosstest/test_fcmp_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698