aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/bitsliced-aes
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-26 21:00:36 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-26 21:00:36 +0100
commitb2e35bf85d1d1db02aa7f74ee45a47f79463d99f (patch)
tree9087bed636b6e18ee408951e7e7e15bc2a0a6e71 /test/monniaux/bitsliced-aes
parentd52a401b30a7618c1b36cc1e6bd514c843136690 (diff)
downloadcompcert-kvx-b2e35bf85d1d1db02aa7f74ee45a47f79463d99f.tar.gz
compcert-kvx-b2e35bf85d1d1db02aa7f74ee45a47f79463d99f.zip
ternary transfo
Diffstat (limited to 'test/monniaux/bitsliced-aes')
-rw-r--r--test/monniaux/bitsliced-aes/bs.c13
-rw-r--r--test/monniaux/bitsliced-aes/notes.txt25
2 files changed, 37 insertions, 1 deletions
diff --git a/test/monniaux/bitsliced-aes/bs.c b/test/monniaux/bitsliced-aes/bs.c
index df5c1f6b..3fc2ff8f 100644
--- a/test/monniaux/bitsliced-aes/bs.c
+++ b/test/monniaux/bitsliced-aes/bs.c
@@ -2,6 +2,17 @@
#include <string.h>
#include "bs.h"
+word_t compcert_ternary(word_t x, word_t v0, word_t v1) {
+ return (((-(x==0)) & v0) | ((-(x!=0)) & v1));
+}
+
+/* Original
+ #define TERNARY0(cmp,v1) ((cmp) ? (v1) : 0) */
+#define TERNARY0(cmp,v1) (-(cmp != 0) & (v1))
+/*
+#define TERNARY0(cmp,v1) compcert_ternary(cmp, 0, v1)
+*/
+
#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) ||\
defined(__amd64__) || defined(__amd32__)|| defined(__amd16__)
#define bs2le(x) (x)
@@ -392,7 +403,7 @@ void bs_transpose_dst(word_t * transpose, word_t * blocks)
for(j=0; j < WORD_SIZE; j++)
{
// TODO make const time
- transpose[offset + j] |= (w & (ONE << j)) ? bitpos : 0;
+ transpose[offset + j] |= TERNARY0((w & (ONE << j)), bitpos);
}
#else
diff --git a/test/monniaux/bitsliced-aes/notes.txt b/test/monniaux/bitsliced-aes/notes.txt
new file mode 100644
index 00000000..954809cc
--- /dev/null
+++ b/test/monniaux/bitsliced-aes/notes.txt
@@ -0,0 +1,25 @@
+* original
+==> test.ccomp.host.out <==
+cycles: 3080223
+
+==> test.ccomp.k1c.out <==
+cycles: 10145951
+
+==> test.gcc.host.out <==
+cycles: 1485887
+
+==> test.gcc.k1c.out <==
+cycles: 4078535
+
+* neg and
+==> test.ccomp.host.out <==
+cycles: 2905049
+
+==> test.ccomp.k1c.out <==
+cycles: 7995063
+
+==> test.gcc.host.out <==
+cycles: 1858263
+
+==> test.gcc.k1c.out <==
+cycles: 5255763