From e4ba8d75c29b65d7307c3223a2263e117e8d3c04 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 10 Oct 2018 13:28:46 -0400 Subject: [PATCH] New test file --- tests/experimental/Makefile | 5 ++++- tests/experimental/test-args.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/experimental/test-args.c diff --git a/tests/experimental/Makefile b/tests/experimental/Makefile index d222a640..9213c660 100644 --- a/tests/experimental/Makefile +++ b/tests/experimental/Makefile @@ -1,10 +1,13 @@ OPT=-g #OPT=-O2 +test-args: test-args.c + cc -O2 test-args.c -o test-args + fac-test: fac-test.c cc fac-test.c $(OPT) -fPIC -Wall -I/usr/local/include -L/usr/local/lib -Wl,--export-dynamic -c -o fac-test.o cc fac-test.o /usr/local/share/cyclone/scheme/cyclone/common.o /usr/local/share/cyclone/scheme/base.o /usr/local/share/cyclone/scheme/write.o -pthread -lcyclone -lck -lm -ltommath -ldl $(OPT) -fPIC -Wall -I/usr/local/include -L/usr/local/lib -Wl,--export-dynamic -o fac-test .PHONY: clean clean: - rm -f *.o fac-test + rm -f *.o fac-test test-args diff --git a/tests/experimental/test-args.c b/tests/experimental/test-args.c new file mode 100644 index 00000000..040a88be --- /dev/null +++ b/tests/experimental/test-args.c @@ -0,0 +1,29 @@ +#include +#include + +int *buf; +int fglo() { + return buf[0] + buf[1] + buf[2]; +} +int fargs(int x, int y, int z) { + return x + y + z; +} + +void main() { + buf = calloc(sizeof(int), 3); + long long sum = 0; + int MAX = 1 * 1000; + + for (int a = 0; a < MAX; a++) { + for (int b = 0; b < MAX; b++) { + for (int c = 0; c < MAX; c++) { + buf[0] = a; + buf[1] = b; + buf[2] = c; + sum += fglo(); + //sum += fargs(a, b, c); + } + } + } + printf("%ld\n", sum); +}