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 28 matching lines...) Expand all Loading... |
39 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 39 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
40 typedef bool (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 40 typedef bool (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
41 typedef bool (*FuncTypeSigned)(TypeSigned, TypeSigned); | 41 typedef bool (*FuncTypeSigned)(TypeSigned, TypeSigned); |
42 static struct { | 42 static struct { |
43 const char *Name; | 43 const char *Name; |
44 FuncTypeUnsigned FuncLlc; | 44 FuncTypeUnsigned FuncLlc; |
45 FuncTypeUnsigned FuncSz; | 45 FuncTypeUnsigned FuncSz; |
46 } Funcs[] = { | 46 } Funcs[] = { |
47 #define X(cmp, op) \ | 47 #define X(cmp, op) \ |
48 { \ | 48 { \ |
49 STR(inst), (FuncTypeUnsigned)icmp##cmp, \ | 49 STR(cmp), (FuncTypeUnsigned)icmp##cmp, \ |
50 (FuncTypeUnsigned)Subzero_::icmp##cmp \ | 50 (FuncTypeUnsigned)Subzero_::icmp##cmp \ |
51 } \ | 51 } \ |
52 , | 52 , |
53 ICMP_U_TABLE | 53 ICMP_U_TABLE |
54 #undef X | 54 #undef X |
55 #define X(cmp, op) \ | 55 #define X(cmp, op) \ |
56 { \ | 56 { \ |
57 STR(inst), (FuncTypeUnsigned)(FuncTypeSigned)icmp##cmp, \ | 57 STR(cmp), (FuncTypeUnsigned)(FuncTypeSigned)icmp##cmp, \ |
58 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::icmp##cmp \ | 58 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::icmp##cmp \ |
59 } \ | 59 } \ |
60 , | 60 , |
61 ICMP_S_TABLE | 61 ICMP_S_TABLE |
62 #undef X | 62 #undef X |
63 }; | 63 }; |
64 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 64 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
65 | 65 |
66 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) { | 66 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) { |
67 // This is the "normal" version of the loop nest, for 32-bit or | 67 // This is the "normal" version of the loop nest, for 32-bit or |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; | 126 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; |
127 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 127 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
128 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); | 128 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); |
129 static struct { | 129 static struct { |
130 const char *Name; | 130 const char *Name; |
131 FuncTypeUnsigned FuncLlc; | 131 FuncTypeUnsigned FuncLlc; |
132 FuncTypeUnsigned FuncSz; | 132 FuncTypeUnsigned FuncSz; |
133 } Funcs[] = { | 133 } Funcs[] = { |
134 #define X(cmp, op) \ | 134 #define X(cmp, op) \ |
135 { \ | 135 { \ |
136 STR(inst), (FuncTypeUnsigned)icmp##cmp, \ | 136 STR(cmp), (FuncTypeUnsigned)icmp##cmp, \ |
137 (FuncTypeUnsigned)Subzero_::icmp##cmp \ | 137 (FuncTypeUnsigned)Subzero_::icmp##cmp \ |
138 } \ | 138 } \ |
139 , | 139 , |
140 ICMP_U_TABLE | 140 ICMP_U_TABLE |
141 #undef X | 141 #undef X |
142 #define X(cmp, op) \ | 142 #define X(cmp, op) \ |
143 { \ | 143 { \ |
144 STR(inst), (FuncTypeUnsigned)(FuncTypeSigned)icmp##cmp, \ | 144 STR(cmp), (FuncTypeUnsigned)(FuncTypeSigned)icmp##cmp, \ |
145 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::icmp##cmp \ | 145 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::icmp##cmp \ |
146 } \ | 146 } \ |
147 , | 147 , |
148 ICMP_S_TABLE | 148 ICMP_S_TABLE |
149 #undef X | 149 #undef X |
150 }; | 150 }; |
151 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 151 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
152 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements; | 152 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements; |
153 for (size_t f = 0; f < NumFuncs; ++f) { | 153 for (size_t f = 0; f < NumFuncs; ++f) { |
154 PRNG Index; | 154 PRNG Index; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 template <typename T> | 197 template <typename T> |
198 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 198 void testsVecI1(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
199 typedef typename Vectors<T>::Ty Ty; | 199 typedef typename Vectors<T>::Ty Ty; |
200 typedef Ty (*FuncType)(Ty, Ty); | 200 typedef Ty (*FuncType)(Ty, Ty); |
201 static struct { | 201 static struct { |
202 const char *Name; | 202 const char *Name; |
203 FuncType FuncLlc; | 203 FuncType FuncLlc; |
204 FuncType FuncSz; | 204 FuncType FuncSz; |
205 } Funcs[] = { | 205 } Funcs[] = { |
206 #define X(cmp, op) \ | 206 #define X(cmp, op) \ |
207 { STR(inst), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ | 207 { STR(cmp), (FuncType)icmpi1##cmp, (FuncType)Subzero_::icmpi1##cmp } \ |
208 , | 208 , |
209 ICMP_U_TABLE | 209 ICMP_U_TABLE |
210 ICMP_S_TABLE | 210 ICMP_S_TABLE |
211 }; | 211 }; |
212 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 212 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
213 const static size_t NumElements = Vectors<T>::NumElements; | 213 const static size_t NumElements = Vectors<T>::NumElements; |
214 const static size_t MAX_NUMBER_OF_ELEMENTS_FOR_EXHAUSTIVE_TESTING = 8; | 214 const static size_t MAX_NUMBER_OF_ELEMENTS_FOR_EXHAUSTIVE_TESTING = 8; |
215 | 215 |
216 // Check if the type is small enough to try all possible input pairs. | 216 // Check if the type is small enough to try all possible input pairs. |
217 if (NumElements <= MAX_NUMBER_OF_ELEMENTS_FOR_EXHAUSTIVE_TESTING) { | 217 if (NumElements <= MAX_NUMBER_OF_ELEMENTS_FOR_EXHAUSTIVE_TESTING) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); | 280 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); |
281 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); | 281 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); |
282 testsVecI1<v4i1>(TotalTests, Passes, Failures); | 282 testsVecI1<v4i1>(TotalTests, Passes, Failures); |
283 testsVecI1<v8i1>(TotalTests, Passes, Failures); | 283 testsVecI1<v8i1>(TotalTests, Passes, Failures); |
284 testsVecI1<v16i1>(TotalTests, Passes, Failures); | 284 testsVecI1<v16i1>(TotalTests, Passes, Failures); |
285 | 285 |
286 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes | 286 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes |
287 << " Failures=" << Failures << "\n"; | 287 << " Failures=" << Failures << "\n"; |
288 return Failures; | 288 return Failures; |
289 } | 289 } |
OLD | NEW |