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