aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/bitsliced-tea
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-01-30 13:07:09 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-01-30 13:07:09 +0100
commit472a0e032a7e51a23fdc7b7543480503b0421bcd (patch)
tree9a458dee636ecd561613a5e6a83bfedb415522e9 /test/monniaux/bitsliced-tea
parentb8a398d37d0c7dbc8068b0759f1fb3f9daa11a63 (diff)
downloadcompcert-kvx-472a0e032a7e51a23fdc7b7543480503b0421bcd.tar.gz
compcert-kvx-472a0e032a7e51a23fdc7b7543480503b0421bcd.zip
same format as the others
Diffstat (limited to 'test/monniaux/bitsliced-tea')
-rw-r--r--test/monniaux/bitsliced-tea/Makefile41
-rw-r--r--test/monniaux/bitsliced-tea/bstea_run.c (renamed from test/monniaux/bitsliced-tea/bstea_test.c)13
2 files changed, 44 insertions, 10 deletions
diff --git a/test/monniaux/bitsliced-tea/Makefile b/test/monniaux/bitsliced-tea/Makefile
index b904666c..6ee08b81 100644
--- a/test/monniaux/bitsliced-tea/Makefile
+++ b/test/monniaux/bitsliced-tea/Makefile
@@ -1,5 +1,40 @@
-all:
- $(CC) -Wall -O2 -D__BSTEA_MAIN_ -o bstea_test bstea_test.c bstea.c
+CFLAGS=-Wall -O3
+K1C_CC=k1-mbr-gcc
+K1C_CFLAGS=-Wall -O3 -std=c99
+K1C_CCOMP=../../../ccomp
+K1C_CCOMPFLAGS=-Wall -O3 -D__thread= -D__int128=int
+
+PRODUCTS=bstea.host bstea.gcc.k1c.out bstea.ccomp.k1c.out bstea.ccomp.k1c.s bstea.gcc.k1c.s bstea.gcc.k1c bstea.ccomp.k1c
+
+all: $(PRODUCTS)
+
+%.gcc.k1c.s: %.c
+ $(K1C_CC) $(K1C_CFLAGS) -S $< -o $@
+
+%.gcc.k1c.o: %.gcc.k1c.s
+ $(K1C_CC) $(K1C_CFLAGS) -c $< -o $@
+
+%.ccomp.k1c.s: %.c
+ $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -S $< -o $@
+
+%.ccomp.k1c.o: %.ccomp.k1c.s
+ $(K1C_CCOMP) $(K1C_CCOMPFLAGS) -c $< -o $@
+
+bstea.host: bstea.c bstea_run.c bstea.h ../clock.c
+ $(CC) $(CFLAGS) bstea.c bstea_run.c ../clock.c -o $@
+
+bstea.gcc.k1c.s bstea.ccomp.k1c.s bstea_run.gcc.k1c.s: bstea.h
+
+bstea.gcc.k1c: bstea.gcc.k1c.o bstea_run.gcc.k1c.o ../clock.gcc.k1c.o
+ $(K1C_CC) $(K1C_CFLAGS) $+ -o $@
+
+bstea.ccomp.k1c: bstea.ccomp.k1c.o bstea_run.gcc.k1c.o ../clock.gcc.k1c.o
+ $(K1C_CCOMP) $(K1C_CCOMPFLAGS) $+ -o $@
+
+%.k1c.out: %.k1c
+ k1-cluster --cycle-based -- $< | tee $@
clean:
- rm -f bstea_test
+ $(RM) -f $(PRODUCTS) bstea.gcc.k1c.o bstea.ccomp.k1c.o bstea_run.gcc.k1c.o bstea_run.gcc.k1c.s
+
+.PHONY: clean
diff --git a/test/monniaux/bitsliced-tea/bstea_test.c b/test/monniaux/bitsliced-tea/bstea_run.c
index 85c750bd..782aa632 100644
--- a/test/monniaux/bitsliced-tea/bstea_test.c
+++ b/test/monniaux/bitsliced-tea/bstea_run.c
@@ -4,7 +4,7 @@
#include "bstea.h"
-
+#include "../clock.h"
/* pack and unpack a single value all over the data path */
static void pack(uint32_t *v, size_t len, vector_width_t *bv) {
@@ -71,6 +71,8 @@ static void test_vectors() {
0x41ea3a0a, 0x4e8e7829} } };
for (i = 0; i < sizeof(testv)/sizeof(tvector_t); ++i) {
+ clock_start();
+
for (j = 0;j < TEA_BLOCK_SIZE;++j) v[j] = 0;
for (j = 0;j < TEA_KEY_SIZE;++j) k[j] = 0;
@@ -108,17 +110,14 @@ static void test_vectors() {
&& testv[i].key[2] == key[2] \
&& testv[i].key[3] == key[3] );
+ clock_stop();
+
printf("test vector, %i,\t[PASSED]\n", i);
}
}
-
-#ifdef __BSTEA_MAIN_
-
int main(int argc, char *argv[]) {
test_vectors();
-
+ print_total_clock();
return 0;
}
-
-#endif /* __BSTEA_MAIN_ */