aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/bitsliced-tea/bstea.h
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-29 06:57:23 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-29 06:57:23 +0100
commit38c676f5591b53f34eb96eb1772bb6165763263d (patch)
treec0efafd8de25a1753ec71efa2cf263cd939b065f /test/monniaux/bitsliced-tea/bstea.h
parentcea4f858490678f6cc1eeddec04f7ed5dc9f5c19 (diff)
downloadcompcert-kvx-38c676f5591b53f34eb96eb1772bb6165763263d.tar.gz
compcert-kvx-38c676f5591b53f34eb96eb1772bb6165763263d.zip
bitsliced-tea slightly more efficient with ternaries at some places
Diffstat (limited to 'test/monniaux/bitsliced-tea/bstea.h')
-rw-r--r--test/monniaux/bitsliced-tea/bstea.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/monniaux/bitsliced-tea/bstea.h b/test/monniaux/bitsliced-tea/bstea.h
index 305bd403..fa767996 100644
--- a/test/monniaux/bitsliced-tea/bstea.h
+++ b/test/monniaux/bitsliced-tea/bstea.h
@@ -6,6 +6,20 @@
#include "bstea_wordsize.h"
+static inline long compcert_ternary_signedl(long x, long v0, long v1) {
+ return ((-(x==0)) & v0) | ((-(x!=0)) & v1);
+}
+
+static inline uint32_t compcert_ternary(uint32_t x, uint32_t v0, uint32_t v1) {
+ return compcert_ternary_signedl(x, v0, v1);
+}
+
+#if defined(__K1C__)
+#define TERNARY(x, v1, v0) compcert_ternary((x), (v0), (v1))
+#else
+#define TERNARY(x, v1, v0) ((x) ? (v1) : (v0))
+#endif
+
#define TEA_ROUNDS 32
#define TEA_BLOCK_SIZE 64