diff options
Diffstat (limited to 'test')
31 files changed, 839 insertions, 397 deletions
diff --git a/test/c/Makefile b/test/c/Makefile index 72814390..a2a80e06 100644 --- a/test/c/Makefile +++ b/test/c/Makefile @@ -8,7 +8,9 @@ EXECUTE:=timeout --signal=SIGTERM 20s $(EXECUTE) LIBS=$(LIBMATH) -TIME=ocaml unix.cma ../../tools/xtime.ml -o /dev/null -mintime 2.0 -minruns 4 +TIME=time >/dev/null +# FIXME - maybe this is better? From v3.6 +# TIME=ocaml unix.cma ../../tools/xtime.ml -o /dev/null -mintime 2.0 -minruns 4 PROGS?=fib integr qsort fft fftsp fftw sha1 sha3 aes almabench \ lists binarytrees fannkuch mandelbrot nbody \ diff --git a/test/c/Results/mandelbrot-mppa_k1c b/test/c/Results/mandelbrot-mppa_k1c Binary files differindex 246f7ce1..f50961fe 100644 --- a/test/c/Results/mandelbrot-mppa_k1c +++ b/test/c/Results/mandelbrot-mppa_k1c diff --git a/test/c/aes.c b/test/c/aes.c index 16f02e47..0a64fe60 100644 --- a/test/c/aes.c +++ b/test/c/aes.c @@ -1441,6 +1441,10 @@ int main(int argc, char ** argv) (u8 *)"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF", (u8 *)"\x8E\xA2\xB7\xCA\x51\x67\x45\xBF\xEA\xFC\x49\x90\x4B\x49\x60\x89", 5, 6); +#ifdef __K1C__ + do_bench(2000); +#else do_bench(1000000); +#endif return 0; } diff --git a/test/c/almabench.c b/test/c/almabench.c index 5487b062..4417200c 100644 --- a/test/c/almabench.c +++ b/test/c/almabench.c @@ -42,10 +42,15 @@ #define R2D (180.0 / PI) #define GAUSSK 0.01720209895 #define TEST_LOOPS 20 -#define TEST_LENGTH 36525 #define sineps 0.3977771559319137 #define coseps 0.9174820620691818 +#ifdef __K1C__ +#define TEST_LENGTH 12 +#else +#define TEST_LENGTH 36525 +#endif + const double amas [8] = { 6023600.0, 408523.5, 328900.5, 3098710.0, 1047.355, 3498.5, 22869.0, 19314.0 }; const double a [8][3] = diff --git a/test/c/mandelbrot.c b/test/c/mandelbrot.c index 133d55c5..fb8b929c 100644 --- a/test/c/mandelbrot.c +++ b/test/c/mandelbrot.c @@ -27,7 +27,7 @@ int main (int argc, char **argv) if (argc < 2) { #ifdef __K1C__ - w = h = 50; + w = h = 40; #else w = h = 1000; #endif diff --git a/test/c/sha1.c b/test/c/sha1.c index 0a6ac8fe..624030cc 100644 --- a/test/c/sha1.c +++ b/test/c/sha1.c @@ -231,6 +231,10 @@ int main(int argc, char ** argv) } do_test(test_input_1, test_output_1); do_test(test_input_2, test_output_2); +#ifdef __K1C__ + do_bench(500); +#else do_bench(200000); +#endif return 0; } diff --git a/test/c/sha3.c b/test/c/sha3.c index a0905817..164e3086 100644 --- a/test/c/sha3.c +++ b/test/c/sha3.c @@ -190,8 +190,13 @@ test_triplet_t testvec[4] = { } }; +#ifdef __K1C__ +#define DATALEN 1000 +#define NITER 7 +#else #define DATALEN 100000 #define NITER 25 +#endif int main() { diff --git a/test/c/siphash24.c b/test/c/siphash24.c index 4a42e013..ce0df78c 100644 --- a/test/c/siphash24.c +++ b/test/c/siphash24.c @@ -235,13 +235,19 @@ int test_vectors() u8 testdata[100] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 12, 34, 56, 78, 90 }; +#ifdef __K1C__ +#define NITER 1000 +#else +#define NITER 1000000 +#endif + int speed_test(void) { u8 out[8], k[16]; int i; for(i = 0; i < 16; ++i ) k[i] = i; - for(i = 0; i < 1000000; i++) { + for(i = 0; i < NITER; i++) { testdata[99] = (u8) i; crypto_auth(out, testdata, 100, k); } diff --git a/test/endian.h b/test/endian.h index 8be2850c..d6e121f4 100644 --- a/test/endian.h +++ b/test/endian.h @@ -1,7 +1,7 @@ #if defined(__ppc__) || defined(__PPC__) || defined(__ARMEB__) #define ARCH_BIG_ENDIAN #elif defined(__i386__) || defined(__x86_64__) || defined(__ARMEL__) \ - || defined(__riscv) || defined(__aarch64__) + || defined(__riscv) || defined(__aarch64__) || defined(__K1C__) #undef ARCH_BIG_ENDIAN #else #error "unknown endianness" diff --git a/test/monniaux/Makefile b/test/monniaux/Makefile index a6b19891..d7437eea 100644 --- a/test/monniaux/Makefile +++ b/test/monniaux/Makefile @@ -20,9 +20,12 @@ oracle_times.txt: PostpassSchedulingOracle.patch bash build_benches.sh $@ measures.csv: - (cd ../../ && make -j20 && make install) - bash build_benches.sh - bash run_benches.sh $@ + @echo "Building compcert.." + @(cd ../../ && make -s -j20 && make -s install) + @echo "Building benches..." + @bash build_benches.sh + @echo "Benches built. Running benches..." + @bash run_benches.sh $@ #compile_times.pdf: gencompile.py verifier_times.txt oracle_times.txt # python3.5 $^ $@ @@ -32,4 +35,5 @@ measures.csv: .PHONY: clean: + @bash clean_benches.sh rm -f verifier_times.txt oracle_times.txt compile_times.pdf measure_times.k1c.pdf measures.csv diff --git a/test/monniaux/README.md b/test/monniaux/README.md index dbb3f337..14b062da 100644 --- a/test/monniaux/README.md +++ b/test/monniaux/README.md @@ -1,13 +1,18 @@ -# Benchmarking CompCert and GCC +# Benchmarking `CompCert` and GCC -rules.mk contains generic rules to compile with gcc and ccomp, with different -optimizations, and producing different binaries. It also produces a -measures.csv file containing the different timings given by the bench. +## Compiling `CompCert` -Up to 5 different optimizations can be used. +The first step to benchmark `CompCert` is to compile it - the `INSTALL.md` instructions of the project root folder should guide you on installing it. -To use this rule.mk, create a folder, put inside all the .c/.h source files, -and write a Makefile ressembling: +For the benchmarks to work, the compiler `ccomp` should be on your `$PATH`, with the runtime libraries installed correctly (with a successful `make install` on the project root directory). + +## Using the harness + +`rules.mk` contains generic rules to compile with `gcc` and `ccomp`, with different optimizations, and producing different binaries. It also produces a `measures.csv` file containing the different timings given by the bench. + +Up to 5 different sets of optimizations per compiler can be used. + +To use this `rules.mk`, create a folder, put inside all the .c/.h source files, and write a Makefile resembling: ```make TARGET=float_mat MEASURES="c1 c2 c3 c4 c5 c6 c7 c8" @@ -15,57 +20,88 @@ MEASURES="c1 c2 c3 c4 c5 c6 c7 c8" include ../rules.mk ``` -This is all that is required to write, the rules.mk handles everything. +This is all that is required to write, the `rules.mk` handles everything. -There is the possibility to define some variables to finetune what you want. -For instance, `ALL_CFILES` describes the .c source files whose objects are -to be linked. +There is the possibility to define some variables to fine tune what you want. For instance, `ALL_CFILES` describes the .c source files whose objects are to be linked. Here is an exhaustive list of the variables: - `TARGET`: name of the binary to produce - `MEASURES`: list of the different timings. This supposes that the program -prints something of the form "c3 cycles: 44131" for instance. In the above -example, the Makefile would generate such a line: -``` -float_mat c3, 1504675, 751514, 553235, 1929369, 1372441 -``` +prints something of the form `c3 cycles: 44131`. - `ALL_CFILES`: list of .c files to compile. By default, `$(wildcard *.c)` -- `CLOCK`: basename of the clock file to compile. Default `../clock` -- `ALL_CFLAGS`: cflags that are to be included for all compilers +- `CLOCK`: `basename` of the clock file to compile. Default `../clock` +- `ALL_CFLAGS`: `cflags` that are to be included for all compilers - `ALL_GCCFLAGS`: same, but GCC specific -- `ALL_CCOMPFLAGS`: same, but ccomp specific -- `K1C_CC`: GCC compiler (default k1-cos-gcc) -- `K1C_CCOMP`: compcert compiler (default ccomp) -- `EXECUTE_CYCLES`: running command (default `k1-cluster` with some options) -- `GCCiFLAGS` with i from 0 to 4: the wanted optimizations. If one of these flags is empty, nothing is done. Same for `CCOMPiFLAGS`. For now, the default values: -``` -# You can define up to GCC4FLAGS and CCOMP4FLAGS -GCC0FLAGS?= -GCC1FLAGS?=$(ALL_GCCFLAGS) -O1 -GCC2FLAGS?=$(ALL_GCCFLAGS) -O2 -GCC3FLAGS?=$(ALL_GCCFLAGS) -O3 -GCC4FLAGS?= -CCOMP0FLAGS?= -CCOMP1FLAGS?=$(ALL_CCOMPFLAGS) -fno-postpass -CCOMP2FLAGS?=$(ALL_CCOMPFLAGS) -CCOMP3FLAGS?= -CCOMP4FLAGS?= - -# Prefix names -GCC0PREFIX?= -GCC1PREFIX?=.gcc.o1 -GCC2PREFIX?=.gcc.o2 -GCC3PREFIX?=.gcc.o3 -GCC4PREFIX?= -CCOMP0PREFIX?= -CCOMP1PREFIX?=.ccomp.o1 -CCOMP2PREFIX?=.ccomp.o2 -CCOMP3PREFIX?= -CCOMP4PREFIX?= -``` +- `ALL_CCOMPFLAGS`: same, but `ccomp` specific +- `K1C_CC`: GCC compiler (default `k1-cos-gcc`) +- `K1C_CCOMP`: `CompCert` compiler (default `ccomp`) +- `EXECUTE_CYCLES`: running command (default is `k1-cluster --syscall=libstd_scalls.so --cycle-based --`) +- `EXECUTE_ARGS`: execution arguments. You can use a macro `__BASE__` which expands to the name of the binary being executed. +- `GCCiFLAGS` with `i` from 0 to 4: the wanted optimizations. If one of these flags is empty, nothing is done. Same for `CCOMPiFLAGS`. Look at `rules.mk` to see the default values. You might find something like this: + + # You can define up to GCC4FLAGS and CCOMP4FLAGS + GCC0FLAGS?= + GCC1FLAGS?=$(ALL_GCCFLAGS) -O1 + GCC2FLAGS?=$(ALL_GCCFLAGS) -O2 + GCC3FLAGS?=$(ALL_GCCFLAGS) -O3 + GCC4FLAGS?= + CCOMP0FLAGS?= + CCOMP1FLAGS?=$(ALL_CCOMPFLAGS) -fno-postpass + CCOMP2FLAGS?=$(ALL_CCOMPFLAGS) + CCOMP3FLAGS?= + CCOMP4FLAGS?= + + # Prefix names + GCC0PREFIX?= + GCC1PREFIX?=.gcc.o1 + GCC2PREFIX?=.gcc.o2 + GCC3PREFIX?=.gcc.o3 + GCC4PREFIX?= + CCOMP0PREFIX?= + CCOMP1PREFIX?=.ccomp.o1 + CCOMP2PREFIX?=.ccomp.o2 + CCOMP3PREFIX?= + CCOMP4PREFIX?= + +The `PREFIX` are the prefixes to add to the secondary produced files (assembly, object, executable, ..). You should be careful that if a `FLAGS` is set, then the according `PREFIX` should be set as well. + +Assembly files are generated in `asm/`, objects in `obj/`, binaries in `bin/` and outputs in `out/`. + +To compile and execute all the benches : `make` while in the `monniaux` directory (without any `-j` flag). Doing so will compile CompCert, install it, and then proceed to execute each bench. + +To compile and/or execute a single bench, `cd` to the bench directory, then: +- `make` for compiling the bench +- `make run` for running it + +You can use `-j` flag when in a single bench directory. + +## Individual scripts + +If you want to run the building and running scripts individually without having to use the `Makefile` from `test/monniaux`, you can run the `build_benches.sh` script which builds each bench using all the available cores on your machine. + +Once the benches are built, you can then run `run_benches.sh file.csv` where `file.csv` is where you want to store the timings of the benchmarks. `run_benches.sh` also uses all the available cores of your machine. + +## Adding timings to a benchmark + +If you just add a benchmark without any timing function, the resulting `measures.csv` file will be empty for lack of timing output. + +To add a timing, you must use the functions whose prototypes are in `clock.h` + + #include "../clock.h" + /* ... */ + clock_prepare(); + /* ... */ + clock_start(); + /* .. computations .. */ + clock_stop(); + /* ... */ + print_total_clock(); // print to stdout + printerr_total_clock(); // print to stderr + +If the benchmark doesn't use `stdout` in a binary way you can use `print_total_clock()`. However, some benchmarks like `jpeg-6b` print their binary content to `stdout`, which then messes up the `grep` command when attempting to use it to extract the cycles from `stdout`. -The `PREFIX` are the prefixes to add to the .s, .o, etc.. You should be careful that if a FLAGS is set, then the according PREFIX should be set as well. +The solution is then to use `printerr_total_clock()` which will print the cycles to `stderr`, and use `EXECUTE_ARGS` ressembling this: -Assembly files will be generated in `asm/`, objects in `obj/`, binaries in `bin/` and outputs in `out/`. + EXECUTE_ARGS=-dct int -outfile __BASE__.jpg testimg.ppm 2> __BASE__.out -To compile and execute all the benches : `make` +`__BASE__` is a macro that gets expanded to the base name - that is, the `TARGET` concatenated with one of the `GCCiPREFIX` or `CCOMPiPREFIX`. For instance, in `jpeg-6b`, `__BASE__` could be `jpeg-6b.ccomp.o2`. diff --git a/test/monniaux/benches.sh b/test/monniaux/benches.sh index 2365063a..434e1b15 100644 --- a/test/monniaux/benches.sh +++ b/test/monniaux/benches.sh @@ -1,3 +1,3 @@ -benches="binary_search bitsliced-aes bitsliced-tea complex float_mat glibc_qsort heapsort idea number_theoretic_transform quicksort sha-2 tacle-bench-lift tacle-bench-powerwindow too_slow heptagon_radio_transmitter lustrev4_lustrec_heater_control lustrev4_lv4_heater_control lustrev4_lv6-en-2cgc_heater_control lustrev6-convertible-en-2cgc xor_and_mat" +benches="binary_search bitsliced-aes bitsliced-tea complex float_mat glibc_qsort heapsort idea number_theoretic_transform quicksort sha-2 tacle-bench-lift tacle-bench-powerwindow too_slow heptagon_radio_transmitter lustrev4_lustrec_heater_control lustrev4_lv4_heater_control lustrev4_lv6-en-2cgc_heater_control lustrev6-convertible-en-2cgc xor_and_mat glpk-4.65 picosat-965 genann jpeg-6b zlib-1.2.11 ocaml tiff-4.0.10 ncompress" # Removed for now : ternary diff --git a/test/monniaux/build_benches.sh b/test/monniaux/build_benches.sh index 931cebac..01abf55d 100755 --- a/test/monniaux/build_benches.sh +++ b/test/monniaux/build_benches.sh @@ -2,15 +2,21 @@ TMPFILE=/tmp/1513times.txt +cores=$(grep -c ^processor /proc/cpuinfo) source benches.sh +default="\e[39m" +magenta="\e[35m" +red="\e[31m" + rm -f commands.txt rm -f $TMPFILE for bench in $benches; do + echo -e "${magenta}Building $bench..${default}" if [ "$1" == "" ]; then - (cd $bench && make -j20) + (cd $bench && make -s -j$cores > /dev/null &> /dev/null) || { echo -e "${red}Build failed" && break; } else - (cd $bench && make -j20) | grep -P "\d+: \d+\.\d+" >> $TMPFILE + (cd $bench && make -j$cores) | grep -P "\d+: \d+\.\d+" >> $TMPFILE fi done diff --git a/test/monniaux/clean_benches.sh b/test/monniaux/clean_benches.sh index c0a87ff9..dff15fd4 100755 --- a/test/monniaux/clean_benches.sh +++ b/test/monniaux/clean_benches.sh @@ -1,8 +1,12 @@ source benches.sh +blue="\e[34m" +default="\e[39m" + rm -f commands.txt for bench in $benches; do - (cd $bench && make clean) + echo -e "${blue}Cleaning $bench..${default}" + (cd $bench && make -s clean) done rm -f *.o diff --git a/test/monniaux/genann/Makefile b/test/monniaux/genann/Makefile new file mode 100644 index 00000000..2e76ec63 --- /dev/null +++ b/test/monniaux/genann/Makefile @@ -0,0 +1,4 @@ +ALL_CFILES= example4shorter.c genann.c +TARGET=genann4 + +include ../rules.mk diff --git a/test/monniaux/genann/make.proto b/test/monniaux/genann/make.proto deleted file mode 100644 index 7c4248bf..00000000 --- a/test/monniaux/genann/make.proto +++ /dev/null @@ -1,2 +0,0 @@ -sources: example4shorter.c genann.c -target: genann4
\ No newline at end of file diff --git a/test/monniaux/glpk-4.65/Makefile b/test/monniaux/glpk-4.65/Makefile index a0ab40dc..eaa3f4b0 100644 --- a/test/monniaux/glpk-4.65/Makefile +++ b/test/monniaux/glpk-4.65/Makefile @@ -1,39 +1,6 @@ ALL_CFLAGS += -I src/amd -I src/colamd -I src/mpl -I src/simplex -I src/api -I src/intopt -I src/minisat -I src/npp -I src/zlib -I src/bflib -I src/env -I src/misc -I src/draft -I src - -include ../rules.mk - -LIBS = -lm - -src=examples/glpsol.c $(wildcard src/*/*.c) - -PRODUCTS?=glpsol.gcc.host glpsol.ccomp.host glpsol.gcc.k1c glpsol.gcc.o1.k1c glpsol.ccomp.k1c -PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS)) - -all: $(PRODUCTS) - -.PHONY: -run: measures.csv - - -glpsol.gcc.host: $(src:.c=.gcc.host.o) ../clock.gcc.host.o - $(CC) $(CFLAGS) $+ $(LIBS) -o $@ -glpsol.ccomp.host: $(src:.c=.ccomp.host.o) ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ $(LIBS) -o $@ -glpsol.gcc.k1c: $(src:.c=.gcc.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ $(LIBS) -o $@ -glpsol.gcc.o1.k1c: $(src:.c=.gcc.o1.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) $+ $(LIBS) -o $@ -glpsol.ccomp.k1c: $(src:.c=.ccomp.k1c.o) ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ $(LIBS) -o $@ - +ALL_CFILES=examples/glpsol.c $(wildcard src/*/*.c) +TARGET=glpk EXECUTE_ARGS=--math examples/prod.mod -measures.csv: $(PRODUCTS_OUT) - echo "benches, gcc host,ccomp host,gcc k1c,gcc o1 k1c,ccomp k1c" > $@ - -.SECONDARY: - -.PHONY: -clean: - rm -f *.o *.s *.k1c *.csv - +include ../rules.mk diff --git a/test/monniaux/jpeg-6b/Makefile b/test/monniaux/jpeg-6b/Makefile index 5a45b729..2bec9bb7 100644 --- a/test/monniaux/jpeg-6b/Makefile +++ b/test/monniaux/jpeg-6b/Makefile @@ -1,6 +1,6 @@ -all: cjpeg.gcc.k1c.out djpeg.gcc.k1c.out cjpeg.gcc.o1.k1c.out djpeg.gcc.o1.k1c.out cjpeg.ccomp.k1c.out djpeg.ccomp.k1c.out +TARGET=jpeg-6b -LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ +ALL_CFILES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \ @@ -8,36 +8,53 @@ LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ jquant2.c jutils.c jmemmgr.c jmemansi.c -CSOURCES=$(LIBSOURCES) rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c rdswitch.c cdjpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c rdcolmap.c +ALL_CFILES+=rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c rdswitch.c cdjpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c rdcolmap.c +ALL_CFILES+=cjpeg.c -LIB_K1C_GCC_OFILES=$(CSOURCES:.c=.gcc.k1c.o) -LIB_K1C_GCC_O1_OFILES=$(CSOURCES:.c=.gcc.o1.k1c.o) -LIB_K1C_CCOMP_OFILES=$(CSOURCES:.c=.ccomp.k1c.o) +EXECUTE_ARGS=-dct int -outfile __BASE__.jpg testimg.ppm 2> __BASE__.out include ../rules.mk -cjpeg.gcc.k1c: $(LIB_K1C_GCC_OFILES) cjpeg.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ ../clock.gcc.k1c.o -djpeg.gcc.k1c: $(LIB_K1C_GCC_OFILES) djpeg.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ ../clock.gcc.k1c.o - -cjpeg.gcc.o1.k1c: $(LIB_K1C_GCC_O1_OFILES) cjpeg.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) -o $@ $+ ../clock.gcc.k1c.o -djpeg.gcc.o1.k1c: $(LIB_K1C_GCC_O1_OFILES) djpeg.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) -o $@ $+ ../clock.gcc.k1c.o - -cjpeg.ccomp.k1c: $(LIB_K1C_CCOMP_OFILES) cjpeg.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ ../clock.gcc.k1c.o -djpeg.ccomp.k1c: $(LIB_K1C_CCOMP_OFILES) djpeg.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ ../clock.gcc.k1c.o - - -djpeg.%.out: djpeg.% - $(EXECUTE_CYCLES) $< -dct int -ppm -outfile $@.ppm testorig.jpg 2> $@ - cmp $@.ppm testimg.ppm 2>> $@ - -cjpeg.%.out: cjpeg.% - $(EXECUTE_CYCLES) $< -dct int -outfile $@.jpg testimg.ppm 2> $@ - cmp $@.jpg testimg.jpg 2>> $@ - -.SECONDARY: +#all: cjpeg.gcc.k1c.out djpeg.gcc.k1c.out cjpeg.gcc.o1.k1c.out djpeg.gcc.o1.k1c.out cjpeg.ccomp.k1c.out djpeg.ccomp.k1c.out +# +#LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \ +# jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ +# jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \ +# jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \ +# jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \ +# jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \ +# jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c \ +# jquant2.c jutils.c jmemmgr.c jmemansi.c +#CSOURCES=$(LIBSOURCES) rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c rdswitch.c cdjpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c rdcolmap.c +# +#LIB_K1C_GCC_OFILES=$(CSOURCES:.c=.gcc.k1c.o) +#LIB_K1C_GCC_O1_OFILES=$(CSOURCES:.c=.gcc.o1.k1c.o) +#LIB_K1C_CCOMP_OFILES=$(CSOURCES:.c=.ccomp.k1c.o) +# +#include ../rules.mk +# +#cjpeg.gcc.k1c: $(LIB_K1C_GCC_OFILES) cjpeg.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ ../clock.gcc.k1c.o +#djpeg.gcc.k1c: $(LIB_K1C_GCC_OFILES) djpeg.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ ../clock.gcc.k1c.o +# +#cjpeg.gcc.o1.k1c: $(LIB_K1C_GCC_O1_OFILES) cjpeg.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS_O1) -o $@ $+ ../clock.gcc.k1c.o +#djpeg.gcc.o1.k1c: $(LIB_K1C_GCC_O1_OFILES) djpeg.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS_O1) -o $@ $+ ../clock.gcc.k1c.o +# +#cjpeg.ccomp.k1c: $(LIB_K1C_CCOMP_OFILES) cjpeg.gcc.k1c.o +# $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ ../clock.gcc.k1c.o +#djpeg.ccomp.k1c: $(LIB_K1C_CCOMP_OFILES) djpeg.gcc.k1c.o +# $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ ../clock.gcc.k1c.o +# +# +#djpeg.%.out: djpeg.% +# $(EXECUTE_CYCLES) $< -dct int -ppm -outfile $@.ppm testorig.jpg 2> $@ +# cmp $@.ppm testimg.ppm 2>> $@ +# +#cjpeg.%.out: cjpeg.% +# $(EXECUTE_CYCLES) $< -dct int -outfile $@.jpg testimg.ppm 2> $@ +# cmp $@.jpg testimg.jpg 2>> $@ +# +#.SECONDARY: diff --git a/test/monniaux/ncompress/Makefile b/test/monniaux/ncompress/Makefile index cf543976..14a99d0b 100644 --- a/test/monniaux/ncompress/Makefile +++ b/test/monniaux/ncompress/Makefile @@ -1,52 +1,4 @@ -include ../rules.mk - -all: check - - -all: compress.gcc.host compress.ccomp.host compress.gcc.k1c compress.ccomp.k1c - -compress.gcc.host : compress42.c ../clock.gcc.host.o - $(CC) $(CFLAGS) $+ -o $@ - -compress.ccomp.host : compress42.c ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ -o $@ - -compress.gcc.k1c : compress42.gcc.k1c.o ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ - -compress.ccomp.k1c : compress42.ccomp.k1c.o ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ - -INFILE=Makefile -COMPRESSED=foo.gcc.host.Z - -foo.gcc.host.Z: compress.gcc.host $(INFILE) - ./compress.gcc.host <$(INFILE) >foo.gcc.host.Z 2> foo.gcc.host.Z.out +TARGET=compress +EXECUTE_ARGS= < Makefile > __BASE__.Z 2> __BASE__.out -foo.ccomp.k1c.Z: compress.ccomp.k1c $(INFILE) - $(EXECUTE) ./compress.ccomp.k1c <$(INFILE) >foo.ccomp.k1c.Z 2> foo.ccomp.k1c.Z.out - -foo.gcc.k1c.Z: compress.gcc.k1c $(INFILE) - $(EXECUTE) ./compress.gcc.k1c <$(INFILE) >foo.gcc.k1c.Z 2> foo.gcc.k1c.Z.out - -foo.gcc.host.txt: compress.gcc.host $(COMPRESSED) - ./compress.gcc.host -d <$(COMPRESSED) >foo.gcc.host.txt 2> foo.gcc.host.txt.out - -foo.ccomp.k1c.txt: compress.gcc.host $(COMPRESSED) - $(EXECUTE) ./compress.ccomp.k1c -d <$(COMPRESSED) >foo.ccomp.k1c.txt 2> foo.ccomp.k1c.txt.out - -foo.gcc.k1c.txt: compress.gcc.host $(COMPRESSED) - $(EXECUTE) ./compress.gcc.k1c -d <$(COMPRESSED) >foo.gcc.k1c.txt 2> foo.gcc.k1c.txt.out - -check: foo.gcc.host.Z foo.gcc.host.txt foo.ccomp.k1c.Z foo.ccomp.k1c.txt foo.gcc.k1c.Z foo.gcc.k1c.txt - cmp foo.gcc.host.Z foo.ccomp.k1c.Z - cmp foo.gcc.host.Z foo.gcc.k1c.Z - cmp foo.gcc.host.txt foo.ccomp.k1c.txt - cmp foo.gcc.host.txt foo.gcc.k1c.txt - -clean: - rm -f *.Z *.txt *.out *.o *.s *.host *.k1c - -.PHONY: clean - -.SECONDARY: %.s +include ../rules.mk diff --git a/test/monniaux/ocaml/Makefile b/test/monniaux/ocaml/Makefile index b63c8864..20f32b65 100644 --- a/test/monniaux/ocaml/Makefile +++ b/test/monniaux/ocaml/Makefile @@ -1,33 +1,6 @@ -ALL_CFLAGS=-Ibyterun +TARGET=ocaml +ALL_CFLAGS=-Ibyterun -lm +ALL_CFILES=$(wildcard byterun/*.c) EXECUTE_ARGS=examples/quicksort include ../rules.mk - -ALL_CCOMPFLAGS= -LDLIBS=-lm - -CFILES=$(wildcard byterun/*.c) - -CCOMP_K1C_S=$(patsubst %.c,%.ccomp.k1c.s,$(CFILES)) -CCOMP_HOST_S=$(patsubst %.c,%.ccomp.host.s,$(CFILES)) - -GCC_K1C_S=$(patsubst %.c,%.gcc.k1c.s,$(CFILES)) -GCC_O1_K1C_S=$(patsubst %.c,%.gcc.o1.k1c.s,$(CFILES)) -GCC_HOST_S=$(patsubst %.c,%.gcc.host.s,$(CFILES)) - -all: $(CCOMP_K1C_S) $(GCC_K1C_S) ocamlrun.ccomp.k1c.out ocamlrun.gcc.k1c.out ocamlrun.gcc.o1.k1c.out - -ocamlrun.ccomp.k1c : $(CCOMP_K1C_S) ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ $(LDLIBS) - -ocamlrun.ccomp.host : $(CCOMP_HOST_S) ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ -o $@ $(LDLIBS) - -ocamlrun.gcc.k1c : $(GCC_K1C_S) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ $(LDLIBS) - -ocamlrun.gcc.o1.k1c : $(GCC_O1_K1C_S) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) $+ -o $@ $(LDLIBS) - -ocamlrun.gcc.host : $(GCC_HOST_S) ../clock.gcc.host.o - $(CC) $(CFLAGS) $+ -o $@ $(LDLIBS) diff --git a/test/monniaux/pcre2-10.32/Makefile b/test/monniaux/pcre2-10.32/Makefile index 98c2c8c2..b6b66c37 100644 --- a/test/monniaux/pcre2-10.32/Makefile +++ b/test/monniaux/pcre2-10.32/Makefile @@ -1,4 +1,7 @@ -CFILES = \ +TARGET=pcre2 +ALL_CFLAGS = -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 +EXECUTE_ARGS=testdata/testinput6 > /dev/null 2> __BASE__.out +ALL_CFILES = \ pcre2_auto_possess.c \ pcre2_chartables.c \ pcre2_compile.c \ @@ -28,39 +31,5 @@ CFILES = \ pcre2posix.c \ pcre2test.c -HFILES = config.h pcre2_internal.h pcre2posix.h \ -pcre2.h pcre2_intmodedep.h pcre2_ucp.h - -K1C_GCC_OFILES=$(CFILES:.c=.gcc.k1c.o) -K1C_GCC_OFILES_O1=$(CFILES:.c=.gcc.o1.k1c.o) -K1C_CCOMP_OFILES=$(CFILES:.c=.ccomp.k1c.o) -K1C_GCC_SFILES=$(CFILES:.c=.gcc.k1c.s) -K1C_CCOMP_SFILES=$(CFILES:.c=.ccomp.k1c.s) -HOST_GCC_OFILES=$(CFILES:.c=.gcc.host.o) - -all: pcre2test.gcc.o1.k1c.out pcre2test.gcc.k1c.out pcre2test.ccomp.k1c.out $(K1C_GCC_SFILES) $(K1C_CCOMP_SFILES) - -ALL_CFLAGS = -DHAVE_CONFIG_H -DPCRE2_CODE_UNIT_WIDTH=8 -EXECUTE_ARGS = testdata/testinput6 - include ../rules.mk - -$(K1C_GCC_SFILES) $(K1C_GCC_OFILES_O1) $(K1C_CCOMP_SFILES) $(HOST_GCC_OFILES): $(HFILES) - -pcre2test.gcc.host: $(HOST_GCC_OFILES) - $(CC) $(CFLAGS) -o $@ $+ ../clock.gcc.host.o - -pcre2test.gcc.k1c: $(K1C_GCC_OFILES) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) -o $@ $+ - -pcre2test.gcc.o1.k1c: $(K1C_GCC_OFILES_O1) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) -o $@ $+ - -pcre2test.ccomp.k1c: $(K1C_CCOMP_OFILES) ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -o $@ $+ - -.PHONY: clean - -clean: - rm -f *.s *.o *.k1c diff --git a/test/monniaux/pcre2-10.32/pcre2test.c b/test/monniaux/pcre2-10.32/pcre2test.c index 25a7c4a1..a1fb64cb 100644 --- a/test/monniaux/pcre2-10.32/pcre2test.c +++ b/test/monniaux/pcre2-10.32/pcre2test.c @@ -8792,7 +8792,7 @@ FREECONTEXTS; #endif clock_stop(); - print_total_clock(); + printerr_total_clock(); return yield; } diff --git a/test/monniaux/picosat-965/Makefile b/test/monniaux/picosat-965/Makefile index 991278ff..a887c0de 100644 --- a/test/monniaux/picosat-965/Makefile +++ b/test/monniaux/picosat-965/Makefile @@ -1,37 +1,11 @@ EXECUTE_ARGS=sudoku.sat - -include ../rules.mk - -#ALL_CFLAGS = -DNDEBUG ALL_CFLAGS = -DNALARM -DNZIP -DNGETRUSAGE -DNDEBUG -K1C_CFLAGS += $(EMBEDDED_CFLAGS) -K1C_CCOMPFLAGS += $(EMBEDDED_CFLAGS) -CCOMPFLAGS += -fbitfields -K1C_CCOMPFLAGS += -fbitfields # -fno-if-conversion - -K1C_CFLAGS += $(ALL_CFLAGS) -K1C_CCOMPFLAGS += $(ALL_CFLAGS) -CCOMPFLAGS += $(ALL_CFLAGS) -CFLAGS += $(ALL_CFLAGS) - -all: picosat.ccomp.k1c.s version.ccomp.k1c.s app.ccomp.k1c.s main.ccomp.k1c.s picosat.gcc.k1c.s version.gcc.k1c.s app.gcc.k1c.s main.gcc.k1c.s picosat.ccomp.k1c.out picosat.gcc.o1.k1c.out picosat.gcc.k1c.out picosat picosat.ccomp.host.out picosat.gcc.host.out - -picosat.ccomp.k1c : picosat.ccomp.k1c.s version.ccomp.k1c.s app.ccomp.k1c.s main.ccomp.k1c.s ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@ +ALL_CCOMPFLAGS += -fbitfields # -fno-if-conversion +TARGET=picosat +ALL_CFILES=picosat.c version.c app.c main.c -picosat.gcc.k1c : picosat.gcc.k1c.s version.gcc.k1c.s app.gcc.k1c.s main.gcc.k1c.s ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ -o $@ - -picosat.gcc.o1.k1c : picosat.gcc.o1.k1c.s version.gcc.o1.k1c.s app.gcc.o1.k1c.s main.gcc.o1.k1c.s ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) $+ -o $@ - -picosat.ccomp.host : picosat.ccomp.host.s version.ccomp.host.s app.ccomp.host.s main.ccomp.host.s ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ -o $@ - -picosat.gcc.host : picosat.gcc.host.s version.gcc.host.s app.gcc.host.s main.gcc.host.s ../clock.gcc.host.o - $(CC) $(FLAGS) $+ -o $@ - -clean: - -rm -f *.s *.k1c *.out +include ../rules.mk -.PHONY: clean +# FIXME - what were these for? +#K1C_CFLAGS += $(EMBEDDED_CFLAGS) +#K1C_CCOMPFLAGS += $(EMBEDDED_CFLAGS) diff --git a/test/monniaux/rules.mk b/test/monniaux/rules.mk index 9d05b4d6..2de2c466 100644 --- a/test/monniaux/rules.mk +++ b/test/monniaux/rules.mk @@ -7,6 +7,9 @@ ALL_CFILES?=$(wildcard *.c) # Name of the target TARGET?=toto +# Arguments of execution +EXECUTE_ARGS?= + # Name of the clock object CLOCK=../clock @@ -25,30 +28,31 @@ K1C_CC?=k1-cos-gcc K1C_CCOMP?=ccomp # Command to execute +#EXECUTE_CYCLES?=timeout --signal=SIGTERM 3m k1-cluster --syscall=libstd_scalls.so --cycle-based -- EXECUTE_CYCLES?=k1-cluster --syscall=libstd_scalls.so --cycle-based -- # You can define up to GCC4FLAGS and CCOMP4FLAGS -GCC0FLAGS?= -GCC1FLAGS?=$(ALL_GCCFLAGS) -O1 -g +GCC0FLAGS?=$(ALL_GCCFLAGS) -O0 +GCC1FLAGS?=$(ALL_GCCFLAGS) -O1 GCC2FLAGS?=$(ALL_GCCFLAGS) -O2 GCC3FLAGS?=$(ALL_GCCFLAGS) -O3 GCC4FLAGS?= -CCOMP0FLAGS?= -CCOMP1FLAGS?=$(ALL_CCOMPFLAGS) -O1 -g -CCOMP2FLAGS?=$(ALL_CCOMPFLAGS) -CCOMP3FLAGS?= +CCOMP0FLAGS?=$(ALL_CCOMPFLAGS) -O2 -fno-postpass +CCOMP1FLAGS?=$(ALL_CCOMPFLAGS) -O2 -fpostpass= greedy +CCOMP2FLAGS?=$(ALL_CCOMPFLAGS) -O2 -fno-if-conversion +CCOMP3FLAGS?=$(ALL_CCOMPFLAGS) -O2 CCOMP4FLAGS?= # Prefix names -GCC0PREFIX?= +GCC0PREFIX?=.gcc.o0 GCC1PREFIX?=.gcc.o1 GCC2PREFIX?=.gcc.o2 GCC3PREFIX?=.gcc.o3 GCC4PREFIX?= -CCOMP0PREFIX?= -CCOMP1PREFIX?=.ccomp.o1 -CCOMP2PREFIX?=.ccomp.o2 -CCOMP3PREFIX?= +CCOMP0PREFIX?=.ccomp.nobundle +CCOMP1PREFIX?=.ccomp.greedy +CCOMP2PREFIX?=.ccomp.noif +CCOMP3PREFIX?=.ccomp CCOMP4PREFIX?= # List of outfiles, updated by gen_rules @@ -92,7 +96,8 @@ obj/%.o: asm/%.s out/%.out: bin/%.bin @mkdir -p $(@D) - $(EXECUTE_CYCLES) $< | tee $@ + @rm -f $@ + $(EXECUTE_CYCLES) $< $(subst __BASE__,$(patsubst %.out,%,$@),$(EXECUTE_ARGS)) | tee -a $@ ## # Generating the rules for all the compiler/flags.. @@ -132,7 +137,7 @@ endif measures.csv: $(OUTFILES) @echo $(FIRSTLINE) > $@ - @for i in $(MEASURES); do\ + @for i in "$(MEASURES)"; do\ first=$$(grep "$$i cycles" $(firstword $(OUTFILES)));\ if test ! -z "$$first"; then\ if [ "$$i" != "time" ]; then\ @@ -153,5 +158,5 @@ run: measures.csv clean: rm -f *.o *.s *.bin *.out - rm -f asm/*.s bin/*.bin obj/*.o out/*.out + rm -rf asm/ bin/ obj/ out/ diff --git a/test/monniaux/run_benches.sh b/test/monniaux/run_benches.sh index 5f9f22cb..2b2e28d6 100755 --- a/test/monniaux/run_benches.sh +++ b/test/monniaux/run_benches.sh @@ -1,12 +1,16 @@ source benches.sh +cores=$(grep -c ^processor /proc/cpuinfo) +processes=$((cores/4)) + rm -f commands.txt for bench in $benches; do - echo "(cd $bench && make -j5 run)" >> commands.txt + echo "(cd $bench && echo \"Running $bench..\" &&\ + make -j4 run > /dev/null && echo \"$bench DONE\")" >> commands.txt done -cat commands.txt | xargs -n1 -I{} -P4 bash -c '{}' +cat commands.txt | xargs -n1 -I{} -P$processes bash -c '{}' ## # Gather all the CSV files diff --git a/test/monniaux/tiff-4.0.10/Makefile b/test/monniaux/tiff-4.0.10/Makefile index db3428fa..ac1aa276 100644 --- a/test/monniaux/tiff-4.0.10/Makefile +++ b/test/monniaux/tiff-4.0.10/Makefile @@ -1,52 +1,7 @@ +TARGET=ppm2tiff +ALL_CFLAGS=-lm ALL_CCOMPFLAGS = -flongdouble +EXECUTE_ARGS= -c g3 __BASE__.g3.tif < example_bw.pbm include ../rules.mk -LIBS=-lm - -src=$(wildcard *.c) - -PRODUCTS?=ppm2tiff.gcc.host ppm2tiff.ccomp.host ppm2tiff.gcc.k1c ppm2tiff.gcc.o1.k1c ppm2tiff.ccomp.k1c -PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS)) - -all: $(PRODUCTS) - -.PHONY: -run: measures.csv - -ppm2tiff.gcc.host: $(src:.c=.gcc.host.o) ../clock.gcc.host.o - $(CC) $(CFLAGS) $+ $(LIBS) -o $@ -ppm2tiff.ccomp.host: $(src:.c=.ccomp.host.o) ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ $(LIBS) -o $@ -ppm2tiff.gcc.k1c: $(src:.c=.gcc.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ $(LIBS) -o $@ -ppm2tiff.gcc.o1.k1c: $(src:.c=.gcc.o1.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) $+ $(LIBS) -o $@ -ppm2tiff.ccomp.k1c: $(src:.c=.ccomp.k1c.o) ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ $(LIBS) -o $@ - -ppm2tiff.gcc.host.out: ppm2tiff.gcc.host - bunzip2 < example_bw.pbm.bz2 | ./$< -c g3 $<.g3.tif | tee $@ - -ppm2tiff.ccomp.host.out: ppm2tiff.ccomp.host - bunzip2 < example_bw.pbm.bz2 | ./$< -c g3 $<.g3.tif | tee $@ - -ppm2tiff.gcc.k1c.out: ppm2tiff.gcc.k1c - bunzip2 < example_bw.pbm.bz2 | $(EXECUTE_CYCLES) ./$< -c g3 $<.g3.tif | tee $@ - -ppm2tiff.gcc.o1.k1c.out: ppm2tiff.gcc.o1.k1c - bunzip2 < example_bw.pbm.bz2 | $(EXECUTE_CYCLES) ./$< -c g3 $<.g3.tif | tee $@ - -ppm2tiff.ccomp.k1c.out: ppm2tiff.ccomp.k1c - bunzip2 < example_bw.pbm.bz2 | $(EXECUTE_CYCLES) ./$< -c g3 $<.g3.tif | tee $@ - -measures.csv: $(PRODUCTS_OUT) - echo "benches, gcc host,ccomp host,gcc k1c,gcc o1 k1c,ccomp k1c" > $@ - echo "ppm2tiff ", $$(grep 'cycles' ppm2tiff.gcc.host.out | cut -d':' -f2), $$(grep 'cycles' ppm2tiff.ccomp.host.out | cut -d':' -f2), $$(grep 'cycles' ppm2tiff.gcc.k1c.out | cut -d':' -f2), $$(grep 'cycles' ppm2tiff.gcc.o1.k1c.out | cut -d':' -f2), $$(grep 'cycles' ppm2tiff.ccomp.k1c.out | cut -d':' -f2)>> $@ - -.SECONDARY: - -.PHONY: -clean: - rm -f *.o *.s *.k1c *.csv - diff --git a/test/monniaux/tiff-4.0.10/example_bw.pbm b/test/monniaux/tiff-4.0.10/example_bw.pbm Binary files differnew file mode 100644 index 00000000..971a82bb --- /dev/null +++ b/test/monniaux/tiff-4.0.10/example_bw.pbm diff --git a/test/monniaux/zlib-1.2.11/Makefile b/test/monniaux/zlib-1.2.11/Makefile index 202f2ea4..9e6920f5 100644 --- a/test/monniaux/zlib-1.2.11/Makefile +++ b/test/monniaux/zlib-1.2.11/Makefile @@ -1,53 +1,62 @@ -ALL_CCOMPFLAGS = -faddx -ALL_CFLAGS = -D_POSIX_C_SOURCE=2 -D_LARGEFILE64_SOURCE=1 -U__STRICT_ANSI__ +TARGET=zlib -include ../rules.mk - -src=$(wildcard *.c) - -PRODUCTS?=minigzip.gcc.host minigzip.ccomp.host minigzip.gcc.k1c minigzip.gcc.o1.k1c minigzip.ccomp.k1c -PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS)) - -all: $(PRODUCTS) - -.PHONY: -run: measures.csv - - -minigzip.gcc.host: $(src:.c=.gcc.host.o) ../clock.gcc.host.o - $(CC) $(CFLAGS) $+ -lm -o $@ -minigzip.ccomp.host: $(src:.c=.ccomp.host.o) ../clock.gcc.host.o - $(CCOMP) $(CCOMPFLAGS) $+ -lm -o $@ -minigzip.gcc.k1c: $(src:.c=.gcc.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS) $+ -lm -o $@ -minigzip.gcc.o1.k1c: $(src:.c=.gcc.o1.k1c.o) ../clock.gcc.k1c.o - $(K1C_CC) $(K1C_CFLAGS_O1) $+ -lm -o $@ -minigzip.ccomp.k1c: $(src:.c=.ccomp.k1c.o) ../clock.gcc.k1c.o - $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -lm -o $@ -measures.csv: $(PRODUCTS_OUT) - echo "benches, gcc host,ccomp host,gcc k1c,gcc o1 k1c,ccomp k1c" > $@ - echo "zlib ", $$(grep 'cycles' minigzip.gcc.host.out | cut -d':' -f2), $$(grep 'cycles' minigzip.ccomp.host.out | cut -d':' -f2), $$(grep 'cycles' minigzip.gcc.k1c.out | cut -d':' -f2), $$(grep 'cycles' minigzip.gcc.o1.k1c.out | cut -d':' -f2), $$(grep 'cycles' minigzip.ccomp.k1c.out | cut -d':' -f2)>> $@ +ALL_CCOMPFLAGS=-faddx +ALL_CFLAGS= -D_POSIX_C_SOURCE=2 -D_LARGEFILE64_SOURCE=1 -U__STRICT_ANSI__ +EXECUTE_ARGS=< zlib_small.txt > /dev/null 2> __BASE__.out -SAMPLE_FILE=zlib.h - -minigzip.gcc.host.out minigzip.gcc.host.output: minigzip.gcc.host - ./$< < $(SAMPLE_FILE) > $<.output 2> $@ - -minigzip.ccomp.host.out minigzip.ccomp.host.output: minigzip.ccomp.host - ./$< < $(SAMPLE_FILE) > $<.output 2> $@ - -minigzip.gcc.k1c.out minigzip.gcc.k1c.output: minigzip.gcc.k1c - $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ - -minigzip.gcc.o1.k1c.out minigzip.gcc.o1.k1c.output: minigzip.gcc.o1.k1c - $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ - -minigzip.ccomp.k1c.out minigzip.ccomp.k1c.output: minigzip.ccomp.k1c - $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ - -.SECONDARY: +include ../rules.mk -.PHONY: -clean: - rm -f *.o *.s *.k1c *.csv +#ALL_CCOMPFLAGS = -faddx +#ALL_CFLAGS = -D_POSIX_C_SOURCE=2 -D_LARGEFILE64_SOURCE=1 -U__STRICT_ANSI__ +# +#include ../rules.mk +# +#src=$(wildcard *.c) +# +#PRODUCTS?=minigzip.gcc.host minigzip.ccomp.host minigzip.gcc.k1c minigzip.gcc.o1.k1c minigzip.ccomp.k1c +#PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS)) +# +#all: $(PRODUCTS) +# +#.PHONY: +#run: measures.csv +# +# +#minigzip.gcc.host: $(src:.c=.gcc.host.o) ../clock.gcc.host.o +# $(CC) $(CFLAGS) $+ -lm -o $@ +#minigzip.ccomp.host: $(src:.c=.ccomp.host.o) ../clock.gcc.host.o +# $(CCOMP) $(CCOMPFLAGS) $+ -lm -o $@ +#minigzip.gcc.k1c: $(src:.c=.gcc.k1c.o) ../clock.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS) $+ -lm -o $@ +#minigzip.gcc.o1.k1c: $(src:.c=.gcc.o1.k1c.o) ../clock.gcc.k1c.o +# $(K1C_CC) $(K1C_CFLAGS_O1) $+ -lm -o $@ +#minigzip.ccomp.k1c: $(src:.c=.ccomp.k1c.o) ../clock.gcc.k1c.o +# $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -lm -o $@ +#measures.csv: $(PRODUCTS_OUT) +# echo "benches, gcc host,ccomp host,gcc k1c,gcc o1 k1c,ccomp k1c" > $@ +# echo "zlib ", $$(grep 'cycles' minigzip.gcc.host.out | cut -d':' -f2), $$(grep 'cycles' minigzip.ccomp.host.out | cut -d':' -f2), $$(grep 'cycles' minigzip.gcc.k1c.out | cut -d':' -f2), $$(grep 'cycles' minigzip.gcc.o1.k1c.out | cut -d':' -f2), $$(grep 'cycles' minigzip.ccomp.k1c.out | cut -d':' -f2)>> $@ +# +#SAMPLE_FILE=zlib.h +# +#minigzip.gcc.host.out minigzip.gcc.host.output: minigzip.gcc.host +# ./$< < $(SAMPLE_FILE) > $<.output 2> $@ +# +#minigzip.ccomp.host.out minigzip.ccomp.host.output: minigzip.ccomp.host +# ./$< < $(SAMPLE_FILE) > $<.output 2> $@ +# +#minigzip.gcc.k1c.out minigzip.gcc.k1c.output: minigzip.gcc.k1c +# $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ +# +#minigzip.gcc.o1.k1c.out minigzip.gcc.o1.k1c.output: minigzip.gcc.o1.k1c +# $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ +# +#minigzip.ccomp.k1c.out minigzip.ccomp.k1c.output: minigzip.ccomp.k1c +# $(EXECUTE_CYCLES) $< < $(SAMPLE_FILE) > $<.output 2> $@ +# +#.SECONDARY: +# +#.PHONY: +#clean: +# rm -f *.o *.s *.k1c *.csv +# diff --git a/test/monniaux/zlib-1.2.11/zlib_small.txt b/test/monniaux/zlib-1.2.11/zlib_small.txt new file mode 100644 index 00000000..2c494200 --- /dev/null +++ b/test/monniaux/zlib-1.2.11/zlib_small.txt @@ -0,0 +1,539 @@ + + + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.11" +#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_SUBREVISION 0 + + + + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; + + uLong total_in; + + uInt avail_out; + + + z_const char *msg; + + + alloc_func zalloc; + + voidpf opaque; + + uLong adler; + +} z_stream; + +typedef z_stream FAR *z_streamp; + + + +typedef struct gz_header_s { + int text; + + int xflags; + + Bytef *extra; + + uInt extra_max; + + uInt name_max; + + uInt comm_max; + + int done; + +} gz_header; + +typedef gz_header FAR *gz_headerp; + + + + + + + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) + + + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) + + + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT + + +#define Z_DEFLATED 8 + + + +#define zlib_version zlibVersion() + + + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); + + + + + + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); + + + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); + + + + + + + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); + + + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); + + + + + + + + + + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); + + + +ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); + + + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); + + + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); + + + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); + + + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); + + + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); + + + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); + + + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); + + + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); + + + + + + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); + + + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); + + + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); + + + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); + + + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); + + + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); + + + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); + + + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); + + + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); + + + + + + +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); + + + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); + + + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); + + + +#ifndef Z_SOLO + + + + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); + + + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); + + + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); + + + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); + + + +ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen)); + + + + + + +typedef struct gzFile_s *gzFile; + + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); + + + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); + + + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); + + + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); + + + +ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, + gzFile file)); + + + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); + + + +ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, + z_size_t nitems, gzFile file)); + + + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); + + + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); + + + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); + + + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); + + + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); + + + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); + + + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); + + + + + + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); + + + + + + + + + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); + + + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); + + + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); + + + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); + + + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); + + + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); + + + +#endif + + + + + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); + + + +ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); + + + + + + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); + + + +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); + + + + + + + + + +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + + + +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); + +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else + + + + diff --git a/test/regression/Makefile b/test/regression/Makefile index 585ffb1c..3447d6a5 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -10,7 +10,7 @@ LIBS=$(LIBMATH) # Can run, both in compiled mode and in interpreter mode, # and have reference output in Results -TESTS=int32 int64 floats floats-basics floats-lit \ +TESTS?=int32 int64 floats floats-basics floats-lit \ expr1 expr6 funptr2 initializers initializers2 initializers3 \ volatile1 volatile2 volatile3 volatile4 \ funct3 expr5 struct7 struct8 struct11 struct12 casts1 casts2 char1 \ diff --git a/test/regression/extasm.c b/test/regression/extasm.c index 8abeb98f..352b930b 100644 --- a/test/regression/extasm.c +++ b/test/regression/extasm.c @@ -24,7 +24,7 @@ int clobbers(int x, int z) || (defined(ARCH_riscV) && defined(MODEL_64)) \ || (defined(ARCH_powerpc) && defined(MODEL_ppc64)) \ || (defined(ARCH_powerpc) && defined(MODEL_e5500)) \ - || (defined(ARCH_mppa_k1c) && defined(MODEL_64)) + || (defined(ARCH_mppa_k1c) && defined(MODEL_64)) \ || defined(ARCH_aarch64) #define SIXTYFOUR #else |