From b4a08d0815342b6238d307864f0823d0f07bb691 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 26 May 2020 22:04:20 +0200 Subject: k1c -> kvx changes --- test/mppa/prng/.gitignore | 4 ++-- test/mppa/prng/Makefile | 32 ++++++++++++++++---------------- test/mppa/prng/README.md | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'test/mppa/prng') diff --git a/test/mppa/prng/.gitignore b/test/mppa/prng/.gitignore index 0792a78b..08023900 100644 --- a/test/mppa/prng/.gitignore +++ b/test/mppa/prng/.gitignore @@ -1,3 +1,3 @@ -prng-test-ccomp-k1c +prng-test-ccomp-kvx prng-test-gcc-x86 -prng-test-gcc-k1c +prng-test-gcc-kvx diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile index 9cbb3872..68e5ffc9 100644 --- a/test/mppa/prng/Makefile +++ b/test/mppa/prng/Makefile @@ -1,18 +1,18 @@ -K1CC ?= k1-cos-gcc +KVXC ?= k1-cos-gcc CC ?= gcc CCOMP ?= ccomp CFLAGS ?= -O2 SIMU ?= k1-mppa TIMEOUT ?= 10s -K1CCPATH=$(shell which $(K1CC)) +KVXCPATH=$(shell which $(KVXC)) CCPATH=$(shell which $(CC)) CCOMPPATH=$(shell which $(CCOMP)) SIMUPATH=$(shell which $(SIMU)) -ALL= prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c -CCOMP_OUT= prng-test-ccomp-k1c.out -GCC_OUT= prng-test-gcc-k1c.out +ALL= prng-test-gcc-x86 prng-test-gcc-kvx prng-test-ccomp-kvx +CCOMP_OUT= prng-test-ccomp-kvx.out +GCC_OUT= prng-test-gcc-kvx.out X86_GCC_OUT= prng-test-gcc-x86.out STUB_OUT=.zero @@ -21,14 +21,14 @@ all: $(ALL) prng-test-gcc-x86: prng.c $(CCPATH) $(CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ -prng-test-gcc-k1c: prng.c $(K1CCPATH) - $(K1CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ +prng-test-gcc-kvx: prng.c $(KVXCPATH) + $(KVXC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ -prng-test-ccomp-k1c: prng.c $(CCOMPPATH) +prng-test-ccomp-kvx: prng.c $(CCOMPPATH) $(CCOMP) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ .SECONDARY: -%k1c.out: %k1c $(SIMUPATH) +%kvx.out: %kvx $(SIMUPATH) ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ %x86.out: %x86 @@ -38,7 +38,7 @@ prng-test-ccomp-k1c: prng.c $(CCOMPPATH) @echo "0" > $@ .PHONY: -test: test-x86 test-k1c +test: test-x86 test-kvx .PHONY: test-x86: $(X86_GCC_OUT) $(STUB_OUT) @@ -49,21 +49,21 @@ test-x86: $(X86_GCC_OUT) $(STUB_OUT) fi .PHONY: -test-k1c: $(GCC_OUT) $(STUB_OUT) +test-kvx: $(GCC_OUT) $(STUB_OUT) @if ! diff $< $(STUB_OUT); then\ - >&2 echo "ERROR k1c: $< failed";\ + >&2 echo "ERROR kvx: $< failed";\ else\ - echo "GOOD k1c: $< succeeded";\ + echo "GOOD kvx: $< succeeded";\ fi .PHONY: check: $(CCOMP_OUT) $(STUB_OUT) @if ! diff $< $(STUB_OUT); then\ - >&2 echo "ERROR k1c: $< failed";\ + >&2 echo "ERROR kvx: $< failed";\ else\ - echo "GOOD k1c: $< succeeded";\ + echo "GOOD kvx: $< succeeded";\ fi .PHONY: clean: - rm -f prng-test-gcc-x86 prng-test-gcc-k1c prng-test-ccomp-k1c + rm -f prng-test-gcc-x86 prng-test-gcc-kvx prng-test-ccomp-kvx diff --git a/test/mppa/prng/README.md b/test/mppa/prng/README.md index b4c2279b..98ed539d 100644 --- a/test/mppa/prng/README.md +++ b/test/mppa/prng/README.md @@ -11,7 +11,7 @@ The following commands can be run inside that folder: - `make`: produces the unitary test binaries - `prng-test-gcc-x86` : binary from gcc on x86 - - `prng-test-k1c-x86` : binary from gcc on k1c - - `prng-test-ccomp-x86` : binary from ccomp on k1c + - `prng-test-kvx-x86` : binary from gcc on kvx + - `prng-test-ccomp-x86` : binary from ccomp on kvx - `make test`: tests the return value of the binaries produced by gcc. - `make check`: tests the return value of the binary produced by CompCert. -- cgit From bc1e43ea95b9455cdccee442db77bc5fafd3dcc6 Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 26 May 2020 22:11:32 +0200 Subject: tests for kvx --- test/mppa/prng/.gitignore | 3 --- test/mppa/prng/Makefile | 69 ----------------------------------------------- test/mppa/prng/README.md | 17 ------------ test/mppa/prng/prng.c | 41 ---------------------------- test/mppa/prng/prng.h | 10 ------- test/mppa/prng/types.h | 7 ----- 6 files changed, 147 deletions(-) delete mode 100644 test/mppa/prng/.gitignore delete mode 100644 test/mppa/prng/Makefile delete mode 100644 test/mppa/prng/README.md delete mode 100644 test/mppa/prng/prng.c delete mode 100644 test/mppa/prng/prng.h delete mode 100644 test/mppa/prng/types.h (limited to 'test/mppa/prng') diff --git a/test/mppa/prng/.gitignore b/test/mppa/prng/.gitignore deleted file mode 100644 index 08023900..00000000 --- a/test/mppa/prng/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -prng-test-ccomp-kvx -prng-test-gcc-x86 -prng-test-gcc-kvx diff --git a/test/mppa/prng/Makefile b/test/mppa/prng/Makefile deleted file mode 100644 index 68e5ffc9..00000000 --- a/test/mppa/prng/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -KVXC ?= k1-cos-gcc -CC ?= gcc -CCOMP ?= ccomp -CFLAGS ?= -O2 -SIMU ?= k1-mppa -TIMEOUT ?= 10s - -KVXCPATH=$(shell which $(KVXC)) -CCPATH=$(shell which $(CC)) -CCOMPPATH=$(shell which $(CCOMP)) -SIMUPATH=$(shell which $(SIMU)) - -ALL= prng-test-gcc-x86 prng-test-gcc-kvx prng-test-ccomp-kvx -CCOMP_OUT= prng-test-ccomp-kvx.out -GCC_OUT= prng-test-gcc-kvx.out -X86_GCC_OUT= prng-test-gcc-x86.out -STUB_OUT=.zero - -all: $(ALL) - -prng-test-gcc-x86: prng.c $(CCPATH) - $(CC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ - -prng-test-gcc-kvx: prng.c $(KVXCPATH) - $(KVXC) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ - -prng-test-ccomp-kvx: prng.c $(CCOMPPATH) - $(CCOMP) -D__UNIT_TEST_PRNG__ $(CFLAGS) $< -o $@ - -.SECONDARY: -%kvx.out: %kvx $(SIMUPATH) - ret=0; timeout $(TIMEOUT) $(SIMU) -- $< > $@ || { ret=$$?; }; echo $$ret >> $@ - -%x86.out: %x86 - ret=0; timeout $(TIMEOUT) ./$< > $@ || { ret=$$?; }; echo $$ret >> $@ - -.zero: - @echo "0" > $@ - -.PHONY: -test: test-x86 test-kvx - -.PHONY: -test-x86: $(X86_GCC_OUT) $(STUB_OUT) - @if ! diff $< $(STUB_OUT); then\ - >&2 echo "ERROR x86: $< failed";\ - else\ - echo "GOOD x86: $< succeeded";\ - fi - -.PHONY: -test-kvx: $(GCC_OUT) $(STUB_OUT) - @if ! diff $< $(STUB_OUT); then\ - >&2 echo "ERROR kvx: $< failed";\ - else\ - echo "GOOD kvx: $< succeeded";\ - fi - -.PHONY: -check: $(CCOMP_OUT) $(STUB_OUT) - @if ! diff $< $(STUB_OUT); then\ - >&2 echo "ERROR kvx: $< failed";\ - else\ - echo "GOOD kvx: $< succeeded";\ - fi - -.PHONY: -clean: - rm -f prng-test-gcc-x86 prng-test-gcc-kvx prng-test-ccomp-kvx diff --git a/test/mppa/prng/README.md b/test/mppa/prng/README.md deleted file mode 100644 index 98ed539d..00000000 --- a/test/mppa/prng/README.md +++ /dev/null @@ -1,17 +0,0 @@ -PRNG -==== - -This is a simple Pseudo Random Number Generator. - -`prng.c` contains a simple unitary test that compares the sum of the "bytewise sum" -of 1000 generated numbers to a hardcoded result, that is the one obtained with -`gcc -O2` on a x86 processor, and returns 0 if the result is correct. - -The following commands can be run inside that folder: - -- `make`: produces the unitary test binaries - - `prng-test-gcc-x86` : binary from gcc on x86 - - `prng-test-kvx-x86` : binary from gcc on kvx - - `prng-test-ccomp-x86` : binary from ccomp on kvx -- `make test`: tests the return value of the binaries produced by gcc. -- `make check`: tests the return value of the binary produced by CompCert. diff --git a/test/mppa/prng/prng.c b/test/mppa/prng/prng.c deleted file mode 100644 index 71de1dc3..00000000 --- a/test/mppa/prng/prng.c +++ /dev/null @@ -1,41 +0,0 @@ -// https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth -// modulo 2^64 = no need to do it explicitly - -#include "types.h" - -#define MULTIPLIER 6364136223846793005LL -#define INCREMENT 1442695040888963407LL - -static uint64_t current; - -void srand(uint64_t seed){ - current = seed; -} - -uint64_t randlong(void){ - return (current = MULTIPLIER * current + INCREMENT); -} - -#ifdef __UNIT_TEST_PRNG__ -char bytewise_sum(uint64_t to_check){ - char sum = 0; - int i; - - for (i = 0 ; i < 8 ; i++) - sum += (to_check & (uint64_t)(0xFFULL << i*8)) >> i*8; - - return sum; -} - -int main(void){ - srand(42); - int i; - - for (i = 0 ; i < 1000 ; i++) - randlong(); - - uint64_t last = randlong(); - - return !((unsigned char)bytewise_sum(last) == 155); -} -#endif // __UNIT_TEST_PRNG__ diff --git a/test/mppa/prng/prng.h b/test/mppa/prng/prng.h deleted file mode 100644 index 6abdb45a..00000000 --- a/test/mppa/prng/prng.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __PRNG_H__ -#define __PRNG_H__ - -#include "types.h" - -void srand(uint64_t seed); - -uint64_t randlong(void); - -#endif // __PRNG_H__ diff --git a/test/mppa/prng/types.h b/test/mppa/prng/types.h deleted file mode 100644 index 584023e3..00000000 --- a/test/mppa/prng/types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ - -#define uint64_t unsigned long long -#define int64_t signed long long - -#endif // __TYPES_H__ -- cgit