| OLD | NEW |
| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 const static size_t MaxTestsPerFunc = 100000; | 196 const static size_t MaxTestsPerFunc = 100000; |
| 197 | 197 |
| 198 template <typename TypeUnsignedLabel, typename TypeSignedLabel> | 198 template <typename TypeUnsignedLabel, typename TypeSignedLabel> |
| 199 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 199 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 200 #ifndef ARM32 | 200 #if !defined(ARM32) && !defined(NONSFI) |
| 201 // TODO(jpp): remove this once vector support is implemented. | 201 // TODO(jpp): remove this once vector support is implemented. |
| 202 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; | 202 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; |
| 203 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; | 203 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; |
| 204 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 204 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
| 205 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); | 205 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); |
| 206 static struct { | 206 static struct { |
| 207 const char *Name; | 207 const char *Name; |
| 208 FuncTypeUnsigned FuncLlc; | 208 FuncTypeUnsigned FuncLlc; |
| 209 FuncTypeUnsigned FuncSz; | 209 FuncTypeUnsigned FuncSz; |
| 210 } Funcs[] = { | 210 } Funcs[] = { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 std::cout << "test" << Funcs[f].Name | 248 std::cout << "test" << Funcs[f].Name |
| 249 << Vectors<TypeUnsignedLabel>::TypeName << "(" | 249 << Vectors<TypeUnsignedLabel>::TypeName << "(" |
| 250 << vectAsString<TypeUnsignedLabel>(Value1) << "," | 250 << vectAsString<TypeUnsignedLabel>(Value1) << "," |
| 251 << vectAsString<TypeUnsignedLabel>(Value2) | 251 << vectAsString<TypeUnsignedLabel>(Value2) |
| 252 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) | 252 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) |
| 253 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) | 253 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) |
| 254 << "\n"; | 254 << "\n"; |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 #endif // ARM32 | 258 #endif // !ARM32 && !NONSFI |
| 259 } | 259 } |
| 260 | 260 |
| 261 // Return true on wraparound | 261 // Return true on wraparound |
| 262 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) { | 262 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) { |
| 263 size_t Pos = 0; | 263 size_t Pos = 0; |
| 264 const static size_t NumElements = Vectors<T>::NumElements; | 264 const static size_t NumElements = Vectors<T>::NumElements; |
| 265 for (Pos = 0; Pos < NumElements; ++Pos) { | 265 for (Pos = 0; Pos < NumElements; ++Pos) { |
| 266 if (Vect[Pos] == 0) { | 266 if (Vect[Pos] == 0) { |
| 267 Vect[Pos] = 1; | 267 Vect[Pos] = 1; |
| 268 break; | 268 break; |
| 269 } | 269 } |
| 270 Vect[Pos] = 0; | 270 Vect[Pos] = 0; |
| 271 } | 271 } |
| 272 return (Pos == NumElements); | 272 return (Pos == NumElements); |
| 273 } | 273 } |
| 274 | 274 |
| 275 template <typename T> | 275 template <typename T> |
| 276 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 276 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 277 #ifndef ARM32 | 277 #if !defined(ARM32) && !defined(NONSFI) |
| 278 // TODO(jpp): remove this once vector support is implemented. | 278 // TODO(jpp): remove this once vector support is implemented. |
| 279 typedef typename Vectors<T>::Ty Ty; | 279 typedef typename Vectors<T>::Ty Ty; |
| 280 typedef Ty (*FuncType)(Ty, Ty); | 280 typedef Ty (*FuncType)(Ty, Ty); |
| 281 static struct { | 281 static struct { |
| 282 const char *Name; | 282 const char *Name; |
| 283 FuncType FuncLlc; | 283 FuncType FuncLlc; |
| 284 FuncType FuncSz; | 284 FuncType FuncSz; |
| 285 } Funcs[] = { | 285 } Funcs[] = { |
| 286 #define X(cmp, op) \ | 286 #define X(cmp, op) \ |
| 287 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ | 287 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } else { | 336 } else { |
| 337 ++Failures; | 337 ++Failures; |
| 338 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" | 338 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" |
| 339 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) | 339 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) |
| 340 << "): sz=" << vectAsString<T>(ResultSz) | 340 << "): sz=" << vectAsString<T>(ResultSz) |
| 341 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; | 341 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 #endif // ARM32 | 346 #endif // !ARM32 && !NONSFI |
| 347 } | 347 } |
| 348 | 348 |
| 349 #ifdef X8664_STACK_HACK | 349 #ifdef X8664_STACK_HACK |
| 350 extern "C" int wrapped_main(int argc, char *argv[]) { | 350 extern "C" int wrapped_main(int argc, char *argv[]) { |
| 351 #else // !defined(X8664_STACK_HACK) | 351 #else // !defined(X8664_STACK_HACK) |
| 352 int main(int argc, char *argv[]) { | 352 int main(int argc, char *argv[]) { |
| 353 #endif // X8664_STACK_HACK | 353 #endif // X8664_STACK_HACK |
| 354 size_t TotalTests = 0; | 354 size_t TotalTests = 0; |
| 355 size_t Passes = 0; | 355 size_t Passes = 0; |
| 356 size_t Failures = 0; | 356 size_t Failures = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 367 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); | 367 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); |
| 368 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); | 368 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); |
| 369 testsVecI1<v4i1>(TotalTests, Passes, Failures); | 369 testsVecI1<v4i1>(TotalTests, Passes, Failures); |
| 370 testsVecI1<v8i1>(TotalTests, Passes, Failures); | 370 testsVecI1<v8i1>(TotalTests, Passes, Failures); |
| 371 testsVecI1<v16i1>(TotalTests, Passes, Failures); | 371 testsVecI1<v16i1>(TotalTests, Passes, Failures); |
| 372 | 372 |
| 373 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 373 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
| 374 << " Failures=" << Failures << "\n"; | 374 << " Failures=" << Failures << "\n"; |
| 375 return Failures; | 375 return Failures; |
| 376 } | 376 } |
| OLD | NEW |