blob: 8f420f15db9dd3abb65d8fff881078f960994af0 [file] [log] [blame]
Matt Wala89a7c2b2014-07-22 10:55:30 -07001//===- subzero/crosstest/test_arith_main.cpp - Driver for tests -----------===//
2//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Driver for crosstesting arithmetic operations
11//
12//===----------------------------------------------------------------------===//
13
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070014/* crosstest.py --test=test_arith.cpp --test=test_arith_frem.ll \
Jan Voungf37fbbe2014-07-09 16:13:13 -070015 --test=test_arith_sqrt.ll --driver=test_arith_main.cpp \
16 --prefix=Subzero_ --output=test_arith */
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070017
18#include <stdint.h>
19
Matt Wala7fa22d82014-07-17 12:41:31 -070020#include <climits> // CHAR_BIT
21#include <limits>
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070022#include <cfloat>
Matt Wala7fa22d82014-07-17 12:41:31 -070023#include <cmath> // fmodf
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070024#include <cstring> // memcmp
25#include <iostream>
26
27// Include test_arith.h twice - once normally, and once within the
28// Subzero_ namespace, corresponding to the llc and Subzero translated
29// object files, respectively.
30#include "test_arith.h"
John Porto1d235422015-08-12 12:37:53 -070031#include "xdefs.h"
32
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070033namespace Subzero_ {
34#include "test_arith.h"
35}
36
Matt Wala7fa22d82014-07-17 12:41:31 -070037template <class T> bool inputsMayTriggerException(T Value1, T Value2) {
38 // Avoid HW divide-by-zero exception.
39 if (Value2 == 0)
40 return true;
41 // Avoid HW overflow exception (on x86-32). TODO: adjust
42 // for other architecture.
43 if (Value1 == std::numeric_limits<T>::min() && Value2 == -1)
44 return true;
45 return false;
46}
47
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070048template <typename TypeUnsigned, typename TypeSigned>
49void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
50 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned);
51 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned);
Matt Wala35ec3732014-07-18 16:32:16 -070052 volatile unsigned Values[] = INT_VALUE_ARRAY;
53 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070054 static struct {
Jim Stichnoth7da431b2014-08-05 11:22:37 -070055 // For functions that operate on unsigned values, the
56 // FuncLlcSigned and FuncSzSigned fields are NULL. For functions
57 // that operate on signed values, the FuncLlcUnsigned and
58 // FuncSzUnsigned fields are NULL.
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070059 const char *Name;
Jim Stichnoth7da431b2014-08-05 11:22:37 -070060 FuncTypeUnsigned FuncLlcUnsigned;
61 FuncTypeUnsigned FuncSzUnsigned;
62 FuncTypeSigned FuncLlcSigned;
63 FuncTypeSigned FuncSzSigned;
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070064 bool ExcludeDivExceptions; // for divide related tests
65 } Funcs[] = {
Matt Walaafeaee42014-08-07 13:47:30 -070066#define X(inst, op, isdiv, isshift) \
Jim Stichnoth7da431b2014-08-05 11:22:37 -070067 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv } \
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070068 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -080069 UINTOP_TABLE
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070070#undef X
Matt Walaafeaee42014-08-07 13:47:30 -070071#define X(inst, op, isdiv, isshift) \
Jim Stichnoth7da431b2014-08-05 11:22:37 -070072 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv } \
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070073 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -080074 SINTOP_TABLE
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070075#undef X
Jim Stichnothd9dc82e2015-03-03 17:06:33 -080076 };
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070077 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
78
79 if (sizeof(TypeUnsigned) <= sizeof(uint32_t)) {
80 // This is the "normal" version of the loop nest, for 32-bit or
81 // narrower types.
82 for (size_t f = 0; f < NumFuncs; ++f) {
83 for (size_t i = 0; i < NumValues; ++i) {
84 for (size_t j = 0; j < NumValues; ++j) {
85 TypeUnsigned Value1 = Values[i];
86 TypeUnsigned Value2 = Values[j];
87 // Avoid HW divide-by-zero exception.
Matt Wala7fa22d82014-07-17 12:41:31 -070088 if (Funcs[f].ExcludeDivExceptions &&
89 inputsMayTriggerException<TypeSigned>(Value1, Value2))
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070090 continue;
91 ++TotalTests;
Jim Stichnoth7da431b2014-08-05 11:22:37 -070092 TypeUnsigned ResultSz, ResultLlc;
93 if (Funcs[f].FuncSzUnsigned) {
94 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2);
95 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2);
96 } else {
97 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2);
98 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2);
99 }
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700100 if (ResultSz == ResultLlc) {
101 ++Passes;
102 } else {
103 ++Failures;
Matt Wala7fa22d82014-07-17 12:41:31 -0700104 std::cout << "test" << Funcs[f].Name
105 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1
106 << ", " << Value2 << "): sz=" << (unsigned)ResultSz
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700107 << " llc=" << (unsigned)ResultLlc << "\n";
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700108 }
109 }
110 }
111 }
112 } else {
113 // This is the 64-bit version. Test values are synthesized from
114 // the 32-bit values in Values[].
115 for (size_t f = 0; f < NumFuncs; ++f) {
116 for (size_t iLo = 0; iLo < NumValues; ++iLo) {
117 for (size_t iHi = 0; iHi < NumValues; ++iHi) {
118 for (size_t jLo = 0; jLo < NumValues; ++jLo) {
119 for (size_t jHi = 0; jHi < NumValues; ++jHi) {
120 TypeUnsigned Value1 =
121 (((TypeUnsigned)Values[iHi]) << 32) + Values[iLo];
122 TypeUnsigned Value2 =
123 (((TypeUnsigned)Values[jHi]) << 32) + Values[jLo];
Matt Wala7fa22d82014-07-17 12:41:31 -0700124 if (Funcs[f].ExcludeDivExceptions &&
125 inputsMayTriggerException<TypeSigned>(Value1, Value2))
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700126 continue;
127 ++TotalTests;
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700128 TypeUnsigned ResultSz, ResultLlc;
129 if (Funcs[f].FuncSzUnsigned) {
130 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2);
131 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2);
132 } else {
133 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2);
134 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2);
135 }
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700136 if (ResultSz == ResultLlc) {
137 ++Passes;
138 } else {
139 ++Failures;
140 std::cout << "test" << Funcs[f].Name
Matt Wala7fa22d82014-07-17 12:41:31 -0700141 << (CHAR_BIT * sizeof(TypeUnsigned)) << "(" << Value1
142 << ", " << Value2 << "): sz=" << (unsigned)ResultSz
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700143 << " llc=" << (unsigned)ResultLlc << "\n";
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700144 }
145 }
146 }
147 }
148 }
149 }
150 }
151}
152
Matt Wala7fa22d82014-07-17 12:41:31 -0700153const static size_t MaxTestsPerFunc = 100000;
154
Matt Wala89a7c2b2014-07-22 10:55:30 -0700155template <typename TypeUnsignedLabel, typename TypeSignedLabel>
Matt Wala7fa22d82014-07-17 12:41:31 -0700156void testsVecInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
Matt Wala89a7c2b2014-07-22 10:55:30 -0700157 typedef typename Vectors<TypeUnsignedLabel>::Ty TypeUnsigned;
158 typedef typename Vectors<TypeSignedLabel>::Ty TypeSigned;
159 typedef typename Vectors<TypeUnsignedLabel>::ElementTy ElementTypeUnsigned;
160 typedef typename Vectors<TypeSignedLabel>::ElementTy ElementTypeSigned;
161
Matt Wala7fa22d82014-07-17 12:41:31 -0700162 typedef TypeUnsigned (*FuncTypeUnsigned)(TypeUnsigned, TypeUnsigned);
163 typedef TypeSigned (*FuncTypeSigned)(TypeSigned, TypeSigned);
Matt Wala35ec3732014-07-18 16:32:16 -0700164 volatile unsigned Values[] = INT_VALUE_ARRAY;
165 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
Matt Wala7fa22d82014-07-17 12:41:31 -0700166 static struct {
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700167 // For functions that operate on unsigned values, the
168 // FuncLlcSigned and FuncSzSigned fields are NULL. For functions
169 // that operate on signed values, the FuncLlcUnsigned and
170 // FuncSzUnsigned fields are NULL.
Matt Wala7fa22d82014-07-17 12:41:31 -0700171 const char *Name;
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700172 FuncTypeUnsigned FuncLlcUnsigned;
173 FuncTypeUnsigned FuncSzUnsigned;
174 FuncTypeSigned FuncLlcSigned;
175 FuncTypeSigned FuncSzSigned;
Matt Wala7fa22d82014-07-17 12:41:31 -0700176 bool ExcludeDivExceptions; // for divide related tests
Matt Walaafeaee42014-08-07 13:47:30 -0700177 bool MaskShiftOperations; // for shift related tests
Matt Wala7fa22d82014-07-17 12:41:31 -0700178 } Funcs[] = {
Matt Walaafeaee42014-08-07 13:47:30 -0700179#define X(inst, op, isdiv, isshift) \
Jim Stichnothdd842db2015-01-27 12:53:53 -0800180 { STR(inst), test##inst, Subzero_::test##inst, NULL, NULL, isdiv, isshift } \
Matt Wala7fa22d82014-07-17 12:41:31 -0700181 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800182 UINTOP_TABLE
Matt Wala7fa22d82014-07-17 12:41:31 -0700183#undef X
Matt Walaafeaee42014-08-07 13:47:30 -0700184#define X(inst, op, isdiv, isshift) \
Jim Stichnothdd842db2015-01-27 12:53:53 -0800185 { STR(inst), NULL, NULL, test##inst, Subzero_::test##inst, isdiv, isshift } \
Matt Wala7fa22d82014-07-17 12:41:31 -0700186 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800187 SINTOP_TABLE
Matt Wala7fa22d82014-07-17 12:41:31 -0700188#undef X
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800189 };
Matt Wala7fa22d82014-07-17 12:41:31 -0700190 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
Matt Wala89a7c2b2014-07-22 10:55:30 -0700191 const static size_t NumElementsInType = Vectors<TypeUnsigned>::NumElements;
Matt Wala7fa22d82014-07-17 12:41:31 -0700192 for (size_t f = 0; f < NumFuncs; ++f) {
193 PRNG Index;
194 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
195 // Initialize the test vectors.
196 TypeUnsigned Value1, Value2;
197 for (size_t j = 0; j < NumElementsInType;) {
Matt Wala35ec3732014-07-18 16:32:16 -0700198 ElementTypeUnsigned Element1 = Values[Index() % NumValues];
199 ElementTypeUnsigned Element2 = Values[Index() % NumValues];
Matt Wala7fa22d82014-07-17 12:41:31 -0700200 if (Funcs[f].ExcludeDivExceptions &&
201 inputsMayTriggerException<ElementTypeSigned>(Element1, Element2))
202 continue;
Matt Walaafeaee42014-08-07 13:47:30 -0700203 if (Funcs[f].MaskShiftOperations)
204 Element2 &= CHAR_BIT * sizeof(ElementTypeUnsigned) - 1;
Matt Wala7fa22d82014-07-17 12:41:31 -0700205 Value1[j] = Element1;
206 Value2[j] = Element2;
207 ++j;
208 }
209 // Perform the test.
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700210 TypeUnsigned ResultSz, ResultLlc;
Matt Wala7fa22d82014-07-17 12:41:31 -0700211 ++TotalTests;
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700212 if (Funcs[f].FuncSzUnsigned) {
213 ResultSz = Funcs[f].FuncSzUnsigned(Value1, Value2);
214 ResultLlc = Funcs[f].FuncLlcUnsigned(Value1, Value2);
215 } else {
216 ResultSz = Funcs[f].FuncSzSigned(Value1, Value2);
217 ResultLlc = Funcs[f].FuncLlcSigned(Value1, Value2);
218 }
Matt Wala7fa22d82014-07-17 12:41:31 -0700219 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) {
220 ++Passes;
221 } else {
Matt Wala89a7c2b2014-07-22 10:55:30 -0700222 ++Failures;
Matt Wala7fa22d82014-07-17 12:41:31 -0700223 std::cout << "test" << Funcs[f].Name << "v" << NumElementsInType << "i"
Matt Wala89a7c2b2014-07-22 10:55:30 -0700224 << (CHAR_BIT * sizeof(ElementTypeUnsigned)) << "("
225 << vectAsString<TypeUnsignedLabel>(Value1) << ","
226 << vectAsString<TypeUnsignedLabel>(Value2)
227 << "): sz=" << vectAsString<TypeUnsignedLabel>(ResultSz)
228 << " llc=" << vectAsString<TypeUnsignedLabel>(ResultLlc)
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700229 << "\n";
Matt Wala7fa22d82014-07-17 12:41:31 -0700230 }
231 }
232 }
233}
234
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700235template <typename Type>
236void testsFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
237 static const Type NegInf = -1.0 / 0.0;
238 static const Type PosInf = 1.0 / 0.0;
239 static const Type Nan = 0.0 / 0.0;
Jan Voungf37fbbe2014-07-09 16:13:13 -0700240 static const Type NegNan = -0.0 / 0.0;
Matt Wala7fa22d82014-07-17 12:41:31 -0700241 volatile Type Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700242 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
243 typedef Type (*FuncType)(Type, Type);
244 static struct {
245 const char *Name;
246 FuncType FuncLlc;
247 FuncType FuncSz;
248 } Funcs[] = {
249#define X(inst, op, func) \
250 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \
251 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800252 FPOP_TABLE
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700253#undef X
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800254 };
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700255 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
256
257 for (size_t f = 0; f < NumFuncs; ++f) {
258 for (size_t i = 0; i < NumValues; ++i) {
259 for (size_t j = 0; j < NumValues; ++j) {
260 Type Value1 = Values[i];
261 Type Value2 = Values[j];
262 ++TotalTests;
263 Type ResultSz = Funcs[f].FuncSz(Value1, Value2);
264 Type ResultLlc = Funcs[f].FuncLlc(Value1, Value2);
265 // Compare results using memcmp() in case they are both NaN.
266 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) {
267 ++Passes;
268 } else {
269 ++Failures;
270 std::cout << std::fixed << "test" << Funcs[f].Name
Matt Wala7fa22d82014-07-17 12:41:31 -0700271 << (CHAR_BIT * sizeof(Type)) << "(" << Value1 << ", "
272 << Value2 << "): sz=" << ResultSz << " llc=" << ResultLlc
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700273 << "\n";
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700274 }
275 }
276 }
277 }
Jan Voungf37fbbe2014-07-09 16:13:13 -0700278 for (size_t i = 0; i < NumValues; ++i) {
279 Type Value = Values[i];
280 ++TotalTests;
281 Type ResultSz = Subzero_::mySqrt(Value);
282 Type ResultLlc = mySqrt(Value);
283 // Compare results using memcmp() in case they are both NaN.
284 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) {
285 ++Passes;
286 } else {
287 ++Failures;
Matt Wala7fa22d82014-07-17 12:41:31 -0700288 std::cout << std::fixed << "test_sqrt" << (CHAR_BIT * sizeof(Type)) << "("
289 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700290 << "\n";
Jan Voungf37fbbe2014-07-09 16:13:13 -0700291 }
Jim Stichnoth8c980d02015-03-19 13:01:50 -0700292 ++TotalTests;
293 ResultSz = Subzero_::myFabs(Value);
294 ResultLlc = myFabs(Value);
295 // Compare results using memcmp() in case they are both NaN.
296 if (!memcmp(&ResultSz, &ResultLlc, sizeof(Type))) {
297 ++Passes;
298 } else {
299 ++Failures;
300 std::cout << std::fixed << "test_fabs" << (CHAR_BIT * sizeof(Type)) << "("
301 << Value << "): sz=" << ResultSz << " llc=" << ResultLlc
302 << "\n";
303 }
Jan Voungf37fbbe2014-07-09 16:13:13 -0700304 }
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700305}
306
Matt Wala7fa22d82014-07-17 12:41:31 -0700307void testsVecFp(size_t &TotalTests, size_t &Passes, size_t &Failures) {
308 static const float NegInf = -1.0 / 0.0;
309 static const float PosInf = 1.0 / 0.0;
310 static const float Nan = 0.0 / 0.0;
311 static const float NegNan = -0.0 / 0.0;
312 volatile float Values[] = FP_VALUE_ARRAY(NegInf, PosInf, NegNan, Nan);
313 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
314 typedef v4f32 (*FuncType)(v4f32, v4f32);
315 static struct {
316 const char *Name;
317 FuncType FuncLlc;
318 FuncType FuncSz;
319 } Funcs[] = {
320#define X(inst, op, func) \
321 { STR(inst), (FuncType)test##inst, (FuncType)Subzero_::test##inst } \
322 ,
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800323 FPOP_TABLE
Matt Wala7fa22d82014-07-17 12:41:31 -0700324#undef X
Jim Stichnothd9dc82e2015-03-03 17:06:33 -0800325 };
Matt Wala7fa22d82014-07-17 12:41:31 -0700326 const static size_t NumFuncs = sizeof(Funcs) / sizeof(*Funcs);
327 const static size_t NumElementsInType = 4;
328 for (size_t f = 0; f < NumFuncs; ++f) {
329 PRNG Index;
330 for (size_t i = 0; i < MaxTestsPerFunc; ++i) {
331 // Initialize the test vectors.
332 v4f32 Value1, Value2;
333 for (size_t j = 0; j < NumElementsInType; ++j) {
Matt Wala35ec3732014-07-18 16:32:16 -0700334 Value1[j] = Values[Index() % NumValues];
335 Value2[j] = Values[Index() % NumValues];
Matt Wala7fa22d82014-07-17 12:41:31 -0700336 }
337 // Perform the test.
338 v4f32 ResultSz = Funcs[f].FuncSz(Value1, Value2);
339 v4f32 ResultLlc = Funcs[f].FuncLlc(Value1, Value2);
340 ++TotalTests;
341 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) {
342 ++Passes;
343 } else {
344 ++Failures;
Matt Wala89a7c2b2014-07-22 10:55:30 -0700345 std::cout << "test" << Funcs[f].Name << "v4f32"
346 << "(" << vectAsString<v4f32>(Value1) << ","
347 << vectAsString<v4f32>(Value2)
348 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700349 << vectAsString<v4f32>(ResultLlc) << "\n";
Matt Wala7fa22d82014-07-17 12:41:31 -0700350 }
Jim Stichnoth8c980d02015-03-19 13:01:50 -0700351 // Special case for unary fabs operation. Use Value1, ignore Value2.
352 ResultSz = Subzero_::myFabs(Value1);
353 ResultLlc = myFabs(Value1);
354 ++TotalTests;
355 if (!memcmp(&ResultSz, &ResultLlc, sizeof(ResultSz))) {
356 ++Passes;
357 } else {
358 ++Failures;
359 std::cout << "test_fabs_v4f32"
360 << "(" << vectAsString<v4f32>(Value1)
361 << "): sz=" << vectAsString<v4f32>(ResultSz) << " llc"
362 << vectAsString<v4f32>(ResultLlc) << "\n";
363 }
Matt Wala7fa22d82014-07-17 12:41:31 -0700364 }
365 }
366}
367
John Porto1d235422015-08-12 12:37:53 -0700368#ifdef X8664_STACK_HACK
369extern "C" int wrapped_main(int argc, char *argv[]) {
370#else // !defined(X8664_STACK_HACK)
371int main(int argc, char *argv[]) {
372#endif // X8664_STACK_HACK
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700373 size_t TotalTests = 0;
374 size_t Passes = 0;
375 size_t Failures = 0;
376
Jim Stichnoth3ef786f2014-09-08 11:19:21 -0700377 testsInt<bool, bool>(TotalTests, Passes, Failures);
Jim Stichnoth7da431b2014-08-05 11:22:37 -0700378 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700379 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures);
380 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures);
John Porto1d235422015-08-12 12:37:53 -0700381 testsInt<uint64, int64>(TotalTests, Passes, Failures);
Matt Wala89a7c2b2014-07-22 10:55:30 -0700382 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures);
383 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
384 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700385 testsFp<float>(TotalTests, Passes, Failures);
386 testsFp<double>(TotalTests, Passes, Failures);
Matt Wala7fa22d82014-07-17 12:41:31 -0700387 testsVecFp(TotalTests, Passes, Failures);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700388
389 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
390 << " Failures=" << Failures << "\n";
391 return Failures;
392}