OLD | NEW |
1 /* crosstest.py --test=simple_loop.c --driver=simple_loop_main.c \ | 1 /* crosstest.py --test=simple_loop.c --driver=simple_loop_main.c \ |
2 --prefix=Subzero_ --output=simple_loop */ | 2 --prefix=Subzero_ --output=simple_loop */ |
3 | 3 |
4 #include <stdio.h> | 4 #include <stdio.h> |
5 | 5 |
6 int simple_loop(int *a, int n); | 6 int simple_loop(int *a, int n); |
7 int Subzero_simple_loop(int *a, int n); | 7 int Subzero_simple_loop(int *a, int n); |
8 | 8 |
9 #ifdef X8664_STACK_HACK | |
10 int wrapped_main(int argc, char *argv[]) { | |
11 #else // !defined(X8664_STACK_HACK) | |
12 int main(int argc, char *argv[]) { | 9 int main(int argc, char *argv[]) { |
13 #endif // X8664_STACK_HACK | |
14 unsigned TotalTests = 0; | 10 unsigned TotalTests = 0; |
15 unsigned Passes = 0; | 11 unsigned Passes = 0; |
16 unsigned Failures = 0; | 12 unsigned Failures = 0; |
17 int a[100]; | 13 int a[100]; |
18 for (int i = 0; i < 100; ++i) | 14 for (int i = 0; i < 100; ++i) |
19 a[i] = i * 2 - 100; | 15 a[i] = i * 2 - 100; |
20 for (int i = -2; i < 100; ++i) { | 16 for (int i = -2; i < 100; ++i) { |
21 ++TotalTests; | 17 ++TotalTests; |
22 int llc_result = simple_loop(a, i); | 18 int llc_result = simple_loop(a, i); |
23 int sz_result = Subzero_simple_loop(a, i); | 19 int sz_result = Subzero_simple_loop(a, i); |
24 if (llc_result == sz_result) { | 20 if (llc_result == sz_result) { |
25 ++Passes; | 21 ++Passes; |
26 } else { | 22 } else { |
27 ++Failures; | 23 ++Failures; |
28 printf("Failure: i=%d, llc=%d, sz=%d\n", i, llc_result, sz_result); | 24 printf("Failure: i=%d, llc=%d, sz=%d\n", i, llc_result, sz_result); |
29 } | 25 } |
30 } | 26 } |
31 printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures); | 27 printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures); |
32 return Failures; | 28 return Failures; |
33 } | 29 } |
OLD | NEW |