Chromium Code Reviews

Side by Side Diff: crosstest/test_icmp_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: Fixes the broken lit tests. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 //===- subzero/crosstest/test_icmp_main.cpp - Driver for tests. -----------===// 1 //===- subzero/crosstest/test_icmp_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 cross testing the icmp bitcode instruction 10 // Driver for cross testing the icmp bitcode instruction
(...skipping 107 matching lines...)
118 } 118 }
119 } 119 }
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 const static size_t MaxTestsPerFunc = 100000; 124 const static size_t MaxTestsPerFunc = 100000;
125 125
126 template <typename TypeUnsignedLabel, typename TypeSignedLabel> 126 template <typename TypeUnsignedLabel, typename TypeSignedLabel>
127 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { 127 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
128 #ifndef ARM32
128 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; 129 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned;
129 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; 130 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned;
130 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); 131 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned);
131 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); 132 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned);
132 static struct { 133 static struct {
133 const char *Name; 134 const char *Name;
134 FuncTypeUnsigned FuncLlc; 135 FuncTypeUnsigned FuncLlc;
135 FuncTypeUnsigned FuncSz; 136 FuncTypeUnsigned FuncSz;
136 } Funcs[] = { 137 } Funcs[] = {
137 #define X(cmp, op) \ 138 #define X(cmp, op) \
(...skipping 36 matching lines...)
174 std::cout << "test" << Funcs[f].Name 175 std::cout << "test" << Funcs[f].Name
175 << Vectors<TypeUnsignedLabel>::TypeName << "(" 176 << Vectors<TypeUnsignedLabel>::TypeName << "("
176 << vectAsString<TypeUnsignedLabel>(Value1) << "," 177 << vectAsString<TypeUnsignedLabel>(Value1) << ","
177 << vectAsString<TypeUnsignedLabel>(Value2) 178 << vectAsString<TypeUnsignedLabel>(Value2)
178 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) 179 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz)
179 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) 180 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc)
180 << "\n"; 181 << "\n";
181 } 182 }
182 } 183 }
183 } 184 }
185 #endif // ARM32
184 } 186 }
185 187
186 // Return true on wraparound 188 // Return true on wraparound
187 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) { 189 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) {
188 size_t Pos = 0; 190 size_t Pos = 0;
189 const static size_t NumElements = Vectors<T>::NumElements; 191 const static size_t NumElements = Vectors<T>::NumElements;
190 for (Pos = 0; Pos < NumElements; ++Pos) { 192 for (Pos = 0; Pos < NumElements; ++Pos) {
191 if (Vect[Pos] == 0) { 193 if (Vect[Pos] == 0) {
192 Vect[Pos] = 1; 194 Vect[Pos] = 1;
193 break; 195 break;
194 } 196 }
195 Vect[Pos] = 0; 197 Vect[Pos] = 0;
196 } 198 }
197 return (Pos == NumElements); 199 return (Pos == NumElements);
198 } 200 }
199 201
200 template <typename T> 202 template <typename T>
201 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { 203 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) {
204 #ifndef ARM32
202 typedef typename Vectors<T>::Ty Ty; 205 typedef typename Vectors<T>::Ty Ty;
203 typedef Ty (*FuncType)(Ty, Ty); 206 typedef Ty (*FuncType)(Ty, Ty);
204 static struct { 207 static struct {
205 const char *Name; 208 const char *Name;
206 FuncType FuncLlc; 209 FuncType FuncLlc;
207 FuncType FuncSz; 210 FuncType FuncSz;
208 } Funcs[] = { 211 } Funcs[] = {
209 #define X(cmp, op) \ 212 #define X(cmp, op) \
210 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ 213 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \
211 , 214 ,
(...skipping 47 matching lines...)
259 } else { 262 } else {
260 ++Failures; 263 ++Failures;
261 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" 264 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "("
262 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) 265 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2)
263 << "): sz=" << vectAsString<T>(ResultSz) 266 << "): sz=" << vectAsString<T>(ResultSz)
264 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; 267 << " llc=" << vectAsString<T>(ResultLlc) << "\n";
265 } 268 }
266 } 269 }
267 } 270 }
268 } 271 }
272 #endif // ARM32
269 } 273 }
270 274
271 #ifdef X8664_STACK_HACK 275 #ifdef X8664_STACK_HACK
272 extern "C" int wrapped_main(int argc, char *argv[]) { 276 extern "C" int wrapped_main(int argc, char *argv[]) {
273 #else // !defined(X8664_STACK_HACK) 277 #else // !defined(X8664_STACK_HACK)
274 int main(int argc, char *argv[]) { 278 int main(int argc, char *argv[]) {
275 #endif // X8664_STACK_HACK 279 #endif // X8664_STACK_HACK
276 size_t TotalTests = 0; 280 size_t TotalTests = 0;
277 size_t Passes = 0; 281 size_t Passes = 0;
278 size_t Failures = 0; 282 size_t Failures = 0;
279 283
280 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); 284 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures);
281 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); 285 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures);
282 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); 286 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures);
283 testsInt<uint64, int64>(TotalTests, Passes, Failures); 287 testsInt<uint64, int64>(TotalTests, Passes, Failures);
284 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); 288 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures);
285 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); 289 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
286 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); 290 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
287 testsVecI1<v4i1>(TotalTests, Passes, Failures); 291 testsVecI1<v4i1>(TotalTests, Passes, Failures);
288 testsVecI1<v8i1>(TotalTests, Passes, Failures); 292 testsVecI1<v8i1>(TotalTests, Passes, Failures);
289 testsVecI1<v16i1>(TotalTests, Passes, Failures); 293 testsVecI1<v16i1>(TotalTests, Passes, Failures);
290 294
291 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 295 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
292 << " Failures=" << Failures << "\n"; 296 << " Failures=" << Failures << "\n";
293 return Failures; 297 return Failures;
294 } 298 }
OLDNEW

Powered by Google App Engine