| OLD | NEW |
| 1 //===- subzero/crosstest/test_arith_main.cpp - Driver for tests -----------===// | 1 //===- subzero/crosstest/test_arith_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 crosstesting arithmetic operations | 10 // Driver for crosstesting arithmetic operations |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 template <typename TypeUnsigned, typename TypeSigned> | 46 template <typename TypeUnsigned, typename TypeSigned> |
| 47 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 47 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 48 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 48 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
| 49 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); | 49 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); |
| 50 volatile unsigned Values[] = INT_VALUE_ARRAY; | 50 volatile unsigned Values[] = INT_VALUE_ARRAY; |
| 51 const static size_t NumValues = sizeof(Values) / sizeof(*Values); | 51 const static size_t NumValues = sizeof(Values) / sizeof(*Values); |
| 52 static struct { | 52 static struct { |
| 53 // For functions that operate on unsigned values, the |
| 54 // FuncLlcSigned and FuncSzSigned fields are NULL. For functions |
| 55 // that operate on signed values, the FuncLlcUnsigned and |
| 56 // FuncSzUnsigned fields are NULL. |
| 53 const char *Name; | 57 const char *Name; |
| 54 FuncTypeUnsigned FuncLlc; | 58 FuncTypeUnsigned FuncLlcUnsigned; |
| 55 FuncTypeUnsigned FuncSz; | 59 FuncTypeUnsigned FuncSzUnsigned; |
| 60 FuncTypeSigned FuncLlcSigned; |
| 61 FuncTypeSigned FuncSzSigned; |
| 56 bool ExcludeDivExceptions; // for divide related tests | 62 bool ExcludeDivExceptions; // for divide related tests |
| 57 } Funcs[] = { | 63 } Funcs[] = { |
| 58 #define X(inst, op, isdiv) \ | 64 #define X(inst, op, isdiv) \ |
| 59 { \ | 65 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \ |
| 60 STR(inst), (FuncTypeUnsigned)test##inst, \ | |
| 61 (FuncTypeUnsigned)Subzero_::test##inst, isdiv \ | |
| 62 } \ | |
| 63 , | 66 , |
| 64 UINTOP_TABLE | 67 UINTOP_TABLE |
| 65 #undef X | 68 #undef X |
| 66 #define X(inst, op, isdiv) \ | 69 #define X(inst, op, isdiv) \ |
| 67 { \ | 70 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \ |
| 68 STR(inst), (FuncTypeUnsigned)(FuncTypeSigned)test##inst, \ | |
| 69 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::test##inst, isdiv \ | |
| 70 } \ | |
| 71 , | 71 , |
| 72 SINTOP_TABLE | 72 SINTOP_TABLE |
| 73 #undef X | 73 #undef X |
| 74 }; | 74 }; |
| 75 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 75 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
| 76 | 76 |
| 77 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) { | 77 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) { |
| 78 // This is the "normal" version of the loop nest, for 32-bit or | 78 // This is the "normal" version of the loop nest, for 32-bit or |
| 79 // narrower types. | 79 // narrower types. |
| 80 for (size_t f = 0; f < NumFuncs; ++f) { | 80 for (size_t f = 0; f < NumFuncs; ++f) { |
| 81 for (size_t i = 0; i < NumValues; ++i) { | 81 for (size_t i = 0; i < NumValues; ++i) { |
| 82 for (size_t j = 0; j < NumValues; ++j) { | 82 for (size_t j = 0; j < NumValues; ++j) { |
| 83 TypeUnsigned Value1 = Values[i]; | 83 TypeUnsigned Value1 = Values[i]; |
| 84 TypeUnsigned Value2 = Values[j]; | 84 TypeUnsigned Value2 = Values[j]; |
| 85 // Avoid HW divide-by-zero exception. | 85 // Avoid HW divide-by-zero exception. |
| 86 if (Funcs[f].ExcludeDivExceptions && | 86 if (Funcs[f].ExcludeDivExceptions && |
| 87 inputsMayTriggerException<TypeSigned>(Value1, Value2)) | 87 inputsMayTriggerException<TypeSigned>(Value1, Value2)) |
| 88 continue; | 88 continue; |
| 89 ++TotalTests; | 89 ++TotalTests; |
| 90 TypeUnsigned ResultSz = Funcs[f].FuncSz(Value1, Value2); | 90 TypeUnsigned ResultSz, ResultLlc; |
| 91 TypeUnsigned ResultLlc = Funcs[f].FuncLlc(Value1, Value2); | 91 if (Funcs[f].FuncSzUnsigned) { |
| 92 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2); |
| 93 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2); |
| 94 } else { |
| 95 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2); |
| 96 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2); |
| 97 } |
| 92 if (ResultSz == ResultLlc) { | 98 if (ResultSz == ResultLlc) { |
| 93 ++Passes; | 99 ++Passes; |
| 94 } else { | 100 } else { |
| 95 ++Failures; | 101 ++Failures; |
| 96 std::cout << "test" << Funcs[f].Name | 102 std::cout << "test" << Funcs[f].Name |
| 97 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1 | 103 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1 |
| 98 << ", " << Value2 << "): sz=" << (unsigned)ResultSz | 104 << ", " << Value2 << "): sz=" << (unsigned)ResultSz |
| 99 << " llc=" << (unsigned)ResultLlc << std::endl; | 105 << " llc=" << (unsigned)ResultLlc << "\n"; |
| 100 } | 106 } |
| 101 } | 107 } |
| 102 } | 108 } |
| 103 } | 109 } |
| 104 } else { | 110 } else { |
| 105 // This is the 64-bit version. Test values are synthesized from | 111 // This is the 64-bit version. Test values are synthesized from |
| 106 // the 32-bit values in Values[]. | 112 // the 32-bit values in Values[]. |
| 107 for (size_t f = 0; f < NumFuncs; ++f) { | 113 for (size_t f = 0; f < NumFuncs; ++f) { |
| 108 for (size_t iLo = 0; iLo < NumValues; ++iLo) { | 114 for (size_t iLo = 0; iLo < NumValues; ++iLo) { |
| 109 for (size_t iHi = 0; iHi < NumValues; ++iHi) { | 115 for (size_t iHi = 0; iHi < NumValues; ++iHi) { |
| 110 for (size_t jLo = 0; jLo < NumValues; ++jLo) { | 116 for (size_t jLo = 0; jLo < NumValues; ++jLo) { |
| 111 for (size_t jHi = 0; jHi < NumValues; ++jHi) { | 117 for (size_t jHi = 0; jHi < NumValues; ++jHi) { |
| 112 TypeUnsigned Value1 = | 118 TypeUnsigned Value1 = |
| 113 (((TypeUnsigned)Values[iHi]) << 32) + Values[iLo]; | 119 (((TypeUnsigned)Values[iHi]) << 32) + Values[iLo]; |
| 114 TypeUnsigned Value2 = | 120 TypeUnsigned Value2 = |
| 115 (((TypeUnsigned)Values[jHi]) << 32) + Values[jLo]; | 121 (((TypeUnsigned)Values[jHi]) << 32) + Values[jLo]; |
| 116 if (Funcs[f].ExcludeDivExceptions && | 122 if (Funcs[f].ExcludeDivExceptions && |
| 117 inputsMayTriggerException<TypeSigned>(Value1, Value2)) | 123 inputsMayTriggerException<TypeSigned>(Value1, Value2)) |
| 118 continue; | 124 continue; |
| 119 ++TotalTests; | 125 ++TotalTests; |
| 120 TypeUnsigned ResultSz = Funcs[f].FuncSz(Value1, Value2); | 126 TypeUnsigned ResultSz, ResultLlc; |
| 121 TypeUnsigned ResultLlc = Funcs[f].FuncLlc(Value1, Value2); | 127 if (Funcs[f].FuncSzUnsigned) { |
| 128 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2); |
| 129 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2); |
| 130 } else { |
| 131 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2); |
| 132 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2); |
| 133 } |
| 122 if (ResultSz == ResultLlc) { | 134 if (ResultSz == ResultLlc) { |
| 123 ++Passes; | 135 ++Passes; |
| 124 } else { | 136 } else { |
| 125 ++Failures; | 137 ++Failures; |
| 126 std::cout << "test" << Funcs[f].Name | 138 std::cout << "test" << Funcs[f].Name |
| 127 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1 | 139 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1 |
| 128 << ", " << Value2 << "): sz=" << (unsigned)ResultSz | 140 << ", " << Value2 << "): sz=" << (unsigned)ResultSz |
| 129 << " llc=" << (unsigned)ResultLlc << std::endl; | 141 << " llc=" << (unsigned)ResultLlc << "\n"; |
| 130 } | 142 } |
| 131 } | 143 } |
| 132 } | 144 } |
| 133 } | 145 } |
| 134 } | 146 } |
| 135 } | 147 } |
| 136 } | 148 } |
| 137 } | 149 } |
| 138 | 150 |
| 139 const static size_t MaxTestsPerFunc = 100000; | 151 const static size_t MaxTestsPerFunc = 100000; |
| 140 | 152 |
| 141 template <typename TypeUnsignedLabel, typename TypeSignedLabel> | 153 template <typename TypeUnsignedLabel, typename TypeSignedLabel> |
| 142 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 154 void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 143 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; | 155 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned; |
| 144 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; | 156 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned; |
| 145 typedef typename Vectors<TypeUnsignedLabel>::ElementTy ElementTypeUnsigned; | 157 typedef typename Vectors<TypeUnsignedLabel>::ElementTy ElementTypeUnsigned; |
| 146 typedef typename Vectors<TypeSignedLabel>::ElementTy ElementTypeSigned; | 158 typedef typename Vectors<TypeSignedLabel>::ElementTy ElementTypeSigned; |
| 147 | 159 |
| 148 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); | 160 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned); |
| 149 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); | 161 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned); |
| 150 volatile unsigned Values[] = INT_VALUE_ARRAY; | 162 volatile unsigned Values[] = INT_VALUE_ARRAY; |
| 151 const static size_t NumValues = sizeof(Values) / sizeof(*Values); | 163 const static size_t NumValues = sizeof(Values) / sizeof(*Values); |
| 152 static struct { | 164 static struct { |
| 165 // For functions that operate on unsigned values, the |
| 166 // FuncLlcSigned and FuncSzSigned fields are NULL. For functions |
| 167 // that operate on signed values, the FuncLlcUnsigned and |
| 168 // FuncSzUnsigned fields are NULL. |
| 153 const char *Name; | 169 const char *Name; |
| 154 FuncTypeUnsigned FuncLlc; | 170 FuncTypeUnsigned FuncLlcUnsigned; |
| 155 FuncTypeUnsigned FuncSz; | 171 FuncTypeUnsigned FuncSzUnsigned; |
| 172 FuncTypeSigned FuncLlcSigned; |
| 173 FuncTypeSigned FuncSzSigned; |
| 156 bool ExcludeDivExceptions; // for divide related tests | 174 bool ExcludeDivExceptions; // for divide related tests |
| 157 } Funcs[] = { | 175 } Funcs[] = { |
| 158 #define X(inst, op, isdiv) \ | 176 #define X(inst, op, isdiv) \ |
| 159 { \ | 177 { \ |
| 160 STR(inst), (FuncTypeUnsigned)test##inst, \ | 178 STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv \ |
| 161 (FuncTypeUnsigned)Subzero_::test##inst, isdiv \ | |
| 162 } \ | 179 } \ |
| 163 , | 180 , |
| 164 UINTOP_TABLE | 181 UINTOP_TABLE |
| 165 #undef X | 182 #undef X |
| 166 #define X(inst, op, isdiv) \ | 183 #define X(inst, op, isdiv) \ |
| 167 { \ | 184 { \ |
| 168 STR(inst), (FuncTypeUnsigned)(FuncTypeSigned)test##inst, \ | 185 STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv \ |
| 169 (FuncTypeUnsigned)(FuncTypeSigned)Subzero_::test##inst, isdiv \ | |
| 170 } \ | 186 } \ |
| 171 , | 187 , |
| 172 SINTOP_TABLE | 188 SINTOP_TABLE |
| 173 #undef X | 189 #undef X |
| 174 }; | 190 }; |
| 175 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); | 191 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs); |
| 176 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements; | 192 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements; |
| 177 for (size_t f = 0; f < NumFuncs; ++f) { | 193 for (size_t f = 0; f < NumFuncs; ++f) { |
| 178 PRNG Index; | 194 PRNG Index; |
| 179 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { | 195 for (size_t i = 0; i < MaxTestsPerFunc; ++i) { |
| 180 // Initialize the test vectors. | 196 // Initialize the test vectors. |
| 181 TypeUnsigned Value1, Value2; | 197 TypeUnsigned Value1, Value2; |
| 182 for (size_t j = 0; j < NumElementsInType;) { | 198 for (size_t j = 0; j < NumElementsInType;) { |
| 183 ElementTypeUnsigned Element1 = Values[Index() % NumValues]; | 199 ElementTypeUnsigned Element1 = Values[Index() % NumValues]; |
| 184 ElementTypeUnsigned Element2 = Values[Index() % NumValues]; | 200 ElementTypeUnsigned Element2 = Values[Index() % NumValues]; |
| 185 if (Funcs[f].ExcludeDivExceptions && | 201 if (Funcs[f].ExcludeDivExceptions && |
| 186 inputsMayTriggerException<ElementTypeSigned>(Element1, Element2)) | 202 inputsMayTriggerException<ElementTypeSigned>(Element1, Element2)) |
| 187 continue; | 203 continue; |
| 188 Value1[j] = Element1; | 204 Value1[j] = Element1; |
| 189 Value2[j] = Element2; | 205 Value2[j] = Element2; |
| 190 ++j; | 206 ++j; |
| 191 } | 207 } |
| 192 // Perform the test. | 208 // Perform the test. |
| 193 TypeUnsigned ResultSz = Funcs[f].FuncSz(Value1, Value2); | 209 TypeUnsigned ResultSz, ResultLlc; |
| 194 TypeUnsigned ResultLlc = Funcs[f].FuncLlc(Value1, Value2); | |
| 195 ++TotalTests; | 210 ++TotalTests; |
| 211 if (Funcs[f].FuncSzUnsigned) { |
| 212 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2); |
| 213 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2); |
| 214 } else { |
| 215 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2); |
| 216 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2); |
| 217 } |
| 196 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) { | 218 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) { |
| 197 ++Passes; | 219 ++Passes; |
| 198 } else { | 220 } else { |
| 199 ++Failures; | 221 ++Failures; |
| 200 std::cout << "test" << Funcs[f].Name << "v" << NumElementsInType << "i" | 222 std::cout << "test" << Funcs[f].Name << "v" << NumElementsInType << "i" |
| 201 << (CHAR_BIT * sizeof(ElementTypeUnsigned)) << "(" | 223 << (CHAR_BIT * sizeof(ElementTypeUnsigned)) << "(" |
| 202 << vectAsString<TypeUnsignedLabel>(Value1) << "," | 224 << vectAsString<TypeUnsignedLabel>(Value1) << "," |
| 203 << vectAsString<TypeUnsignedLabel>(Value2) | 225 << vectAsString<TypeUnsignedLabel>(Value2) |
| 204 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) | 226 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz) |
| 205 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) | 227 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc) |
| 206 << std::endl; | 228 << "\n"; |
| 207 } | 229 } |
| 208 } | 230 } |
| 209 } | 231 } |
| 210 } | 232 } |
| 211 | 233 |
| 212 template <typename Type> | 234 template <typename Type> |
| 213 void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 235 void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 214 static const Type NegInf = -1.0 / 0.0; | 236 static const Type NegInf = -1.0 / 0.0; |
| 215 static const Type PosInf = 1.0 / 0.0; | 237 static const Type PosInf = 1.0 / 0.0; |
| 216 static const Type Nan = 0.0 / 0.0; | 238 static const Type Nan = 0.0 / 0.0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 240 Type ResultSz = Funcs[f].FuncSz(Value1, Value2); | 262 Type ResultSz = Funcs[f].FuncSz(Value1, Value2); |
| 241 Type ResultLlc = Funcs[f].FuncLlc(Value1, Value2); | 263 Type ResultLlc = Funcs[f].FuncLlc(Value1, Value2); |
| 242 // Compare results using memcmp() in case they are both NaN. | 264 // Compare results using memcmp() in case they are both NaN. |
| 243 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) { | 265 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) { |
| 244 ++Passes; | 266 ++Passes; |
| 245 } else { | 267 } else { |
| 246 ++Failures; | 268 ++Failures; |
| 247 std::cout << std::fixed << "test" << Funcs[f].Name | 269 std::cout << std::fixed << "test" << Funcs[f].Name |
| 248 << (CHAR_BIT * sizeof(Type)) << "(" << Value1 << ", " | 270 << (CHAR_BIT * sizeof(Type)) << "(" << Value1 << ", " |
| 249 << Value2 << "): sz=" << ResultSz << " llc=" << ResultLlc | 271 << Value2 << "): sz=" << ResultSz << " llc=" << ResultLlc |
| 250 << std::endl; | 272 << "\n"; |
| 251 } | 273 } |
| 252 } | 274 } |
| 253 } | 275 } |
| 254 } | 276 } |
| 255 for (size_t i = 0; i < NumValues; ++i) { | 277 for (size_t i = 0; i < NumValues; ++i) { |
| 256 Type Value = Values[i]; | 278 Type Value = Values[i]; |
| 257 ++TotalTests; | 279 ++TotalTests; |
| 258 Type ResultSz = Subzero_::mySqrt(Value); | 280 Type ResultSz = Subzero_::mySqrt(Value); |
| 259 Type ResultLlc = mySqrt(Value); | 281 Type ResultLlc = mySqrt(Value); |
| 260 // Compare results using memcmp() in case they are both NaN. | 282 // Compare results using memcmp() in case they are both NaN. |
| 261 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) { | 283 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) { |
| 262 ++Passes; | 284 ++Passes; |
| 263 } else { | 285 } else { |
| 264 ++Failures; | 286 ++Failures; |
| 265 std::cout << std::fixed << "test_sqrt" << (CHAR_BIT * sizeof(Type)) << "(" | 287 std::cout << std::fixed << "test_sqrt" << (CHAR_BIT * sizeof(Type)) << "(" |
| 266 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc | 288 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc |
| 267 << std::endl; | 289 << "\n"; |
| 268 } | 290 } |
| 269 } | 291 } |
| 270 } | 292 } |
| 271 | 293 |
| 272 void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { | 294 void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) { |
| 273 static const float NegInf = -1.0 / 0.0; | 295 static const float NegInf = -1.0 / 0.0; |
| 274 static const float PosInf = 1.0 / 0.0; | 296 static const float PosInf = 1.0 / 0.0; |
| 275 static const float Nan = 0.0 / 0.0; | 297 static const float Nan = 0.0 / 0.0; |
| 276 static const float NegNan = -0.0 / 0.0; | 298 static const float NegNan = -0.0 / 0.0; |
| 277 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); | 299 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 304 v4f32 ResultLlc = Funcs[f].FuncLlc(Value1, Value2); | 326 v4f32 ResultLlc = Funcs[f].FuncLlc(Value1, Value2); |
| 305 ++TotalTests; | 327 ++TotalTests; |
| 306 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) { | 328 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) { |
| 307 ++Passes; | 329 ++Passes; |
| 308 } else { | 330 } else { |
| 309 ++Failures; | 331 ++Failures; |
| 310 std::cout << "test" << Funcs[f].Name << "v4f32" | 332 std::cout << "test" << Funcs[f].Name << "v4f32" |
| 311 << "(" << vectAsString<v4f32>(Value1) << "," | 333 << "(" << vectAsString<v4f32>(Value1) << "," |
| 312 << vectAsString<v4f32>(Value2) | 334 << vectAsString<v4f32>(Value2) |
| 313 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc" | 335 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc" |
| 314 << vectAsString<v4f32>(ResultLlc) << std::endl; | 336 << vectAsString<v4f32>(ResultLlc) << "\n"; |
| 315 } | 337 } |
| 316 } | 338 } |
| 317 } | 339 } |
| 318 } | 340 } |
| 319 | 341 |
| 320 int main(int argc, char **argv) { | 342 int main(int argc, char **argv) { |
| 321 size_t TotalTests = 0; | 343 size_t TotalTests = 0; |
| 322 size_t Passes = 0; | 344 size_t Passes = 0; |
| 323 size_t Failures = 0; | 345 size_t Failures = 0; |
| 324 | 346 |
| 325 testsInt<uint8_t, int8_t>(TotalTests, Passes, Failures); | 347 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); |
| 326 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); | 348 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); |
| 327 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); | 349 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); |
| 328 testsInt<uint64_t, int64_t>(TotalTests, Passes, Failures); | 350 testsInt<uint64_t, int64_t>(TotalTests, Passes, Failures); |
| 329 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); | 351 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); |
| 330 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); | 352 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); |
| 331 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); | 353 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); |
| 332 testsFp<float>(TotalTests, Passes, Failures); | 354 testsFp<float>(TotalTests, Passes, Failures); |
| 333 testsFp<double>(TotalTests, Passes, Failures); | 355 testsFp<double>(TotalTests, Passes, Failures); |
| 334 testsVecFp(TotalTests, Passes, Failures); | 356 testsVecFp(TotalTests, Passes, Failures); |
| 335 | 357 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 365 v16si8 Sz_srem_v16i8(v16si8 a, v16si8 b) { return a % b; } | 387 v16si8 Sz_srem_v16i8(v16si8 a, v16si8 b) { return a % b; } |
| 366 v16ui8 Sz_urem_v16i8(v16ui8 a, v16ui8 b) { return a % b; } | 388 v16ui8 Sz_urem_v16i8(v16ui8 a, v16ui8 b) { return a % b; } |
| 367 | 389 |
| 368 v4f32 Sz_frem_v4f32(v4f32 a, v4f32 b) { | 390 v4f32 Sz_frem_v4f32(v4f32 a, v4f32 b) { |
| 369 v4f32 Result; | 391 v4f32 Result; |
| 370 for (int i = 0; i < 4; ++i) | 392 for (int i = 0; i < 4; ++i) |
| 371 Result[i] = fmodf(a[i], b[i]); | 393 Result[i] = fmodf(a[i], b[i]); |
| 372 return Result; | 394 return Result; |
| 373 } | 395 } |
| 374 } | 396 } |
| OLD | NEW |