aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/ternary
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-28 05:22:35 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-28 05:22:35 +0100
commit629252b160fd4b909231bcad6edcf6f254aca0d6 (patch)
tree1654d79e800816bb9fd8f7ab98058e1d790678bd /test/monniaux/ternary
parentcea4f858490678f6cc1eeddec04f7ed5dc9f5c19 (diff)
parentb753bcb6d10bb1bb68fa42eb5ca9eb7e7f848adf (diff)
downloadcompcert-kvx-629252b160fd4b909231bcad6edcf6f254aca0d6.tar.gz
compcert-kvx-629252b160fd4b909231bcad6edcf6f254aca0d6.zip
merge VLIW proofs
Merge branch 'mppa-mul' into mppa-ternary
Diffstat (limited to 'test/monniaux/ternary')
-rw-r--r--test/monniaux/ternary/ternary.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c
index 45201ff8..79025639 100644
--- a/test/monniaux/ternary/ternary.c
+++ b/test/monniaux/ternary/ternary.c
@@ -5,10 +5,16 @@
typedef uint32_t data;
+#if 0
+#define TERNARY(a, b, c) ((a) ? (b) : (c))
+#else
+#define TERNARY(a, b, c) (((-(a)) & (b)) | ((-1+(a)) & (c)))
+#endif
+
data silly_computation(void) {
data x = 1;
for(int i=0; i<10000; i++) {
- x = x * (((x & 0x100) != 0) ? 45561U : 337777U);
+ x = x * TERNARY(((x & 0x100) != 0), 45561U, 337777U);
}
return x;
}