| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 129 // TODO(jpp): remove this once vector support is implemented. |
| 128 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; | 130 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; |
| 129 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; | 131 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; |
| 130 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 132 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
| 131 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); | 133 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); |
| 132 static struct { | 134 static struct { |
| 133 const char *Name; | 135 const char *Name; |
| 134 FuncTypeUnsigned FuncLlc; | 136 FuncTypeUnsigned FuncLlc; |
| 135 FuncTypeUnsigned FuncSz; | 137 FuncTypeUnsigned FuncSz; |
| 136 } Funcs[] = { | 138 } Funcs[] = { |
| 137 #define X(cmp, op) \ | 139 #define X(cmp, op) \ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 std::cout << "test" << Funcs[f].Name | 176 std::cout << "test" << Funcs[f].Name |
| 175 << Vectors<TypeUnsignedLabel>::TypeName << "(" | 177 << Vectors<TypeUnsignedLabel>::TypeName << "(" |
| 176 << vectAsString<TypeUnsignedLabel>(Value1) << "," | 178 << vectAsString<TypeUnsignedLabel>(Value1) << "," |
| 177 << vectAsString<TypeUnsignedLabel>(Value2) | 179 << vectAsString<TypeUnsignedLabel>(Value2) |
| 178 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) | 180 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) |
| 179 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) | 181 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) |
| 180 << "\n"; | 182 << "\n"; |
| 181 } | 183 } |
| 182 } | 184 } |
| 183 } | 185 } |
| 186 #endif // ARM32 |
| 184 } | 187 } |
| 185 | 188 |
| 186 // Return true on wraparound | 189 // Return true on wraparound |
| 187 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) { | 190 template <typename T> bool incrementI1Vector(typename Vectors<T>::Ty &Vect) { |
| 188 size_t Pos = 0; | 191 size_t Pos = 0; |
| 189 const static size_t NumElements = Vectors<T>::NumElements; | 192 const static size_t NumElements = Vectors<T>::NumElements; |
| 190 for (Pos = 0; Pos < NumElements; ++Pos) { | 193 for (Pos = 0; Pos < NumElements; ++Pos) { |
| 191 if (Vect[Pos] == 0) { | 194 if (Vect[Pos] == 0) { |
| 192 Vect[Pos] = 1; | 195 Vect[Pos] = 1; |
| 193 break; | 196 break; |
| 194 } | 197 } |
| 195 Vect[Pos] = 0; | 198 Vect[Pos] = 0; |
| 196 } | 199 } |
| 197 return (Pos == NumElements); | 200 return (Pos == NumElements); |
| 198 } | 201 } |
| 199 | 202 |
| 200 template <typename T> | 203 template <typename T> |
| 201 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 204 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 205 #ifndef ARM32 |
| 206 // TODO(jpp): remove this once vector support is implemented. |
| 202 typedef typename Vectors<T>::Ty Ty; | 207 typedef typename Vectors<T>::Ty Ty; |
| 203 typedef Ty (*FuncType)(Ty, Ty); | 208 typedef Ty (*FuncType)(Ty, Ty); |
| 204 static struct { | 209 static struct { |
| 205 const char *Name; | 210 const char *Name; |
| 206 FuncType FuncLlc; | 211 FuncType FuncLlc; |
| 207 FuncType FuncSz; | 212 FuncType FuncSz; |
| 208 } Funcs[] = { | 213 } Funcs[] = { |
| 209 #define X(cmp, op) \ | 214 #define X(cmp, op) \ |
| 210 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ | 215 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ |
| 211 , | 216 , |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } else { | 264 } else { |
| 260 ++Failures; | 265 ++Failures; |
| 261 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" | 266 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" |
| 262 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) | 267 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) |
| 263 << "): sz=" << vectAsString<T>(ResultSz) | 268 << "): sz=" << vectAsString<T>(ResultSz) |
| 264 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; | 269 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; |
| 265 } | 270 } |
| 266 } | 271 } |
| 267 } | 272 } |
| 268 } | 273 } |
| 274 #endif // ARM32 |
| 269 } | 275 } |
| 270 | 276 |
| 271 #ifdef X8664_STACK_HACK | 277 #ifdef X8664_STACK_HACK |
| 272 extern "C" int wrapped_main(int argc, char *argv[]) { | 278 extern "C" int wrapped_main(int argc, char *argv[]) { |
| 273 #else // !defined(X8664_STACK_HACK) | 279 #else // !defined(X8664_STACK_HACK) |
| 274 int main(int argc, char *argv[]) { | 280 int main(int argc, char *argv[]) { |
| 275 #endif // X8664_STACK_HACK | 281 #endif // X8664_STACK_HACK |
| 276 size_t TotalTests = 0; | 282 size_t TotalTests = 0; |
| 277 size_t Passes = 0; | 283 size_t Passes = 0; |
| 278 size_t Failures = 0; | 284 size_t Failures = 0; |
| 279 | 285 |
| 280 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); | 286 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); |
| 281 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); | 287 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); |
| 282 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); | 288 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); |
| 283 testsInt<uint64, int64>(TotalTests, Passes, Failures); | 289 testsInt<uint64, int64>(TotalTests, Passes, Failures); |
| 284 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); | 290 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); |
| 285 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); | 291 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); |
| 286 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); | 292 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); |
| 287 testsVecI1<v4i1>(TotalTests, Passes, Failures); | 293 testsVecI1<v4i1>(TotalTests, Passes, Failures); |
| 288 testsVecI1<v8i1>(TotalTests, Passes, Failures); | 294 testsVecI1<v8i1>(TotalTests, Passes, Failures); |
| 289 testsVecI1<v16i1>(TotalTests, Passes, Failures); | 295 testsVecI1<v16i1>(TotalTests, Passes, Failures); |
| 290 | 296 |
| 291 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 297 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
| 292 << " Failures=" << Failures << "\n"; | 298 << " Failures=" << Failures << "\n"; |
| 293 return Failures; | 299 return Failures; |
| 294 } | 300 } |
| OLD | NEW |