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

Side by Side Diff: crosstest/mem_intrin_main.cpp

Issue 877003003: Subzero: Use a "known" version of clang-format. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a clang-format blacklist. Fix formatting "errors". Created 5 years, 11 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/mem_intrin.cpp ('k') | crosstest/test_arith_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 /* crosstest.py --test=mem_intrin.cpp --driver=mem_intrin_main.cpp \ 1 /* crosstest.py --test=mem_intrin.cpp --driver=mem_intrin_main.cpp \
2 --prefix=Subzero_ --output=mem_intrin */ 2 --prefix=Subzero_ --output=mem_intrin */
3 3
4 #include <stdint.h> /* cstdint requires -std=c++0x or higher */ 4 #include <stdint.h> /* cstdint requires -std=c++0x or higher */
5 #include <cstdio> 5 #include <cstdio>
6 6
7 #include "mem_intrin.h" 7 #include "mem_intrin.h"
8 namespace Subzero_ { 8 namespace Subzero_ {
9 #include "mem_intrin.h" 9 #include "mem_intrin.h"
10 } 10 }
11 11
12 #define XSTR(s) STR(s) 12 #define XSTR(s) STR(s)
13 #define STR(s) #s 13 #define STR(s) #s
14 14
15 void testFixedLen(size_t &TotalTests, size_t &Passes, size_t &Failures) { 15 void testFixedLen(size_t &TotalTests, size_t &Passes, size_t &Failures) {
16 #define do_test_fixed(test_func) \ 16 #define do_test_fixed(test_func) \
17 for (uint8_t init_val = 0; init_val < 100; ++init_val) { \ 17 for (uint8_t init_val = 0; init_val < 100; ++init_val) { \
18 ++TotalTests; \ 18 ++TotalTests; \
19 int llc_result = test_func(init_val); \ 19 int llc_result = test_func(init_val); \
20 int sz_result = Subzero_::test_func(init_val); \ 20 int sz_result = Subzero_::test_func(init_val); \
21 if (llc_result == sz_result) { \ 21 if (llc_result == sz_result) { \
22 ++Passes; \ 22 ++Passes; \
23 } else { \ 23 } else { \
24 ++Failures; \ 24 ++Failures; \
25 printf("Failure (%s): init_val=%d, llc=%d, sz=%d\n", \ 25 printf("Failure (%s): init_val=%d, llc=%d, sz=%d\n", STR(test_func), \
26 STR(test_func), init_val, llc_result, sz_result); \ 26 init_val, llc_result, sz_result); \
27 } \ 27 } \
28 } 28 }
29 29
30 do_test_fixed(memcpy_test_fixed_len) 30 do_test_fixed(memcpy_test_fixed_len);
31 do_test_fixed(memmove_test_fixed_len) 31 do_test_fixed(memmove_test_fixed_len);
32 do_test_fixed(memset_test_fixed_len) 32 do_test_fixed(memset_test_fixed_len)
33 #undef do_test_fixed 33 #undef do_test_fixed
34 } 34 }
35 35
36 void testVariableLen(size_t &TotalTests, size_t &Passes, size_t &Failures) { 36 void testVariableLen(size_t &TotalTests, size_t &Passes, size_t &Failures) {
37 uint8_t buf[256]; 37 uint8_t buf[256];
38 uint8_t buf2[256]; 38 uint8_t buf2[256];
39 #define do_test_variable(test_func) \ 39 #define do_test_variable(test_func) \
40 for (size_t len = 4; len < 128; ++len) { \ 40 for (size_t len = 4; len < 128; ++len) { \
41 for (uint8_t init_val = 0; init_val < 100; ++init_val) { \ 41 for (uint8_t init_val = 0; init_val < 100; ++init_val) { \
42 ++TotalTests; \ 42 ++TotalTests; \
43 int llc_result = test_func(buf, buf2, init_val, len); \ 43 int llc_result = test_func(buf, buf2, init_val, len); \
44 int sz_result = Subzero_::test_func(buf, buf2, init_val, len); \ 44 int sz_result = Subzero_::test_func(buf, buf2, init_val, len); \
45 if (llc_result == sz_result) { \ 45 if (llc_result == sz_result) { \
46 ++Passes; \ 46 ++Passes; \
47 } else { \ 47 } else { \
48 ++Failures; \ 48 ++Failures; \
49 printf("Failure (%s): init_val=%d, len=%d, llc=%d, sz=%d\n", \ 49 printf("Failure (%s): init_val=%d, len=%d, llc=%d, sz=%d\n", \
50 STR(test_func), init_val, len, llc_result, sz_result); \ 50 STR(test_func), init_val, len, llc_result, sz_result); \
51 } \ 51 } \
52 } \ 52 } \
53 } 53 }
54 54
55 do_test_variable(memcpy_test) 55 do_test_variable(memcpy_test);
56 do_test_variable(memmove_test) 56 do_test_variable(memmove_test);
57 do_test_variable(memset_test) 57 do_test_variable(memset_test)
58 #undef do_test_variable 58 #undef do_test_variable
59 } 59 }
60 60
61 int main(int argc, char **argv) { 61 int main(int argc, char **argv) {
62 unsigned TotalTests = 0; 62 unsigned TotalTests = 0;
63 unsigned Passes = 0; 63 unsigned Passes = 0;
64 unsigned Failures = 0; 64 unsigned Failures = 0;
65 testFixedLen(TotalTests, Passes, Failures); 65 testFixedLen(TotalTests, Passes, Failures);
66 testVariableLen(TotalTests, Passes, Failures); 66 testVariableLen(TotalTests, Passes, Failures);
67 printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures); 67 printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures);
68 return Failures; 68 return Failures;
69 } 69 }
OLDNEW
« no previous file with comments | « crosstest/mem_intrin.cpp ('k') | crosstest/test_arith_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698