New test file

This commit is contained in:
Justin Ethier 2018-10-10 13:28:46 -04:00
parent 536fa42f64
commit e4ba8d75c2
2 changed files with 33 additions and 1 deletions

View file

@ -1,10 +1,13 @@
OPT=-g OPT=-g
#OPT=-O2 #OPT=-O2
test-args: test-args.c
cc -O2 test-args.c -o test-args
fac-test: fac-test.c 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.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 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 .PHONY: clean
clean: clean:
rm -f *.o fac-test rm -f *.o fac-test test-args

View file

@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
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);
}