Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: crosstest/test_icmp_main.cpp

Issue 1273153002: Subzero. Native 64-bit int arithmetic on x86-64. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes tests & make format Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crosstest/test_icmp.cpp ('k') | crosstest/test_select_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // 11 //
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 /* crosstest.py --test=test_icmp.cpp --test=test_icmp_i1vec.ll \ 14 /* crosstest.py --test=test_icmp.cpp --test=test_icmp_i1vec.ll \
15 --driver=test_icmp_main.cpp --prefix=Subzero_ --output=test_icmp */ 15 --driver=test_icmp_main.cpp --prefix=Subzero_ --output=test_icmp */
16 16
17 #include <climits> // CHAR_BIT 17 #include <climits> // CHAR_BIT
18 #include <cstring> // memcmp, memset 18 #include <cstring> // memcmp, memset
19 #include <stdint.h> 19 #include <stdint.h>
20 #include <iostream> 20 #include <iostream>
21 21
22 // Include test_icmp.h twice - once normally, and once within the 22 // Include test_icmp.h twice - once normally, and once within the
23 // Subzero_ namespace, corresponding to the llc and Subzero translated 23 // Subzero_ namespace, corresponding to the llc and Subzero translated
24 // object files, respectively. 24 // object files, respectively.
25 #include "test_icmp.h" 25 #include "test_icmp.h"
26
26 namespace Subzero_ { 27 namespace Subzero_ {
27 #include "test_icmp.h" 28 #include "test_icmp.h"
28 } 29 }
29 30
31 #include "xdefs.h"
32
30 volatile unsigned Values[] = { 33 volatile unsigned Values[] = {
31 0x0, 0x1, 0x7ffffffe, 0x7fffffff, 0x80000000, 0x80000001, 34 0x0, 0x1, 0x7ffffffe, 0x7fffffff, 0x80000000, 0x80000001,
32 0xfffffffe, 0xffffffff, 0x7e, 0x7f, 0x80, 0x81, 35 0xfffffffe, 0xffffffff, 0x7e, 0x7f, 0x80, 0x81,
33 0xfe, 0xff, 0x100, 0x101, 0x7ffe, 0x7fff, 36 0xfe, 0xff, 0x100, 0x101, 0x7ffe, 0x7fff,
34 0x8000, 0x8001, 0xfffe, 0xffff, 0x10000, 0x10001, 37 0x8000, 0x8001, 0xfffe, 0xffff, 0x10000, 0x10001,
35 }; 38 };
36 const static size_t NumValues = sizeof(Values) / sizeof(*Values); 39 const static size_t NumValues = sizeof(Values) / sizeof(*Values);
37 40
38 template <typename TypeUnsigned, typename TypeSigned> 41 template <typename TypeUnsigned, typename TypeSigned>
39 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) { 42 void testsInt(size_t &TotalTests, size_t &Passes, size_t &Failures) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "(" 261 std::cout << "test" << Funcs[f].Name << Vectors<T>::TypeName << "("
259 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2) 262 << vectAsString<T>(Value1) << "," << vectAsString<T>(Value2)
260 << "): sz=" << vectAsString<T>(ResultSz) 263 << "): sz=" << vectAsString<T>(ResultSz)
261 << " llc=" << vectAsString<T>(ResultLlc) << "\n"; 264 << " llc=" << vectAsString<T>(ResultLlc) << "\n";
262 } 265 }
263 } 266 }
264 } 267 }
265 } 268 }
266 } 269 }
267 270
268 int main(int argc, char **argv) { 271 #ifdef X8664_STACK_HACK
272 extern "C" int wrapped_main(int argc, char *argv[]) {
273 #else // !defined(X8664_STACK_HACK)
274 int main(int argc, char *argv[]) {
275 #endif // X8664_STACK_HACK
269 size_t TotalTests = 0; 276 size_t TotalTests = 0;
270 size_t Passes = 0; 277 size_t Passes = 0;
271 size_t Failures = 0; 278 size_t Failures = 0;
272 279
273 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures); 280 testsInt<uint8_t, myint8_t>(TotalTests, Passes, Failures);
274 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures); 281 testsInt<uint16_t, int16_t>(TotalTests, Passes, Failures);
275 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures); 282 testsInt<uint32_t, int32_t>(TotalTests, Passes, Failures);
276 testsInt<uint64_t, int64_t>(TotalTests, Passes, Failures); 283 testsInt<uint64, int64>(TotalTests, Passes, Failures);
277 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures); 284 testsVecInt<v4ui32, v4si32>(TotalTests, Passes, Failures);
278 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures); 285 testsVecInt<v8ui16, v8si16>(TotalTests, Passes, Failures);
279 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures); 286 testsVecInt<v16ui8, v16si8>(TotalTests, Passes, Failures);
280 testsVecI1<v4i1>(TotalTests, Passes, Failures); 287 testsVecI1<v4i1>(TotalTests, Passes, Failures);
281 testsVecI1<v8i1>(TotalTests, Passes, Failures); 288 testsVecI1<v8i1>(TotalTests, Passes, Failures);
282 testsVecI1<v16i1>(TotalTests, Passes, Failures); 289 testsVecI1<v16i1>(TotalTests, Passes, Failures);
283 290
284 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes 291 std::cout << "TotalTests=" << TotalTests << " Passes=" << Passes
285 << " Failures=" << Failures << "\n"; 292 << " Failures=" << Failures << "\n";
286 return Failures; 293 return Failures;
287 } 294 }
OLDNEW
« no previous file with comments | « crosstest/test_icmp.cpp ('k') | crosstest/test_select_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698