diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-24 18:00:19 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-24 18:00:19 +0100 |
commit | 52aeb8026a9d9d2675eebf965d4ff3f87a0e2346 (patch) | |
tree | a38dca1ac9a56114a6a3788efa76b1c93141b90e /test/monniaux/ternary/ternary.c | |
parent | ee49464e9745ed7da517b74791c7c85296184fd3 (diff) | |
download | compcert-kvx-52aeb8026a9d9d2675eebf965d4ff3f87a0e2346.tar.gz compcert-kvx-52aeb8026a9d9d2675eebf965d4ff3f87a0e2346.zip |
demo ternary op
Diffstat (limited to 'test/monniaux/ternary/ternary.c')
-rw-r--r-- | test/monniaux/ternary/ternary.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c new file mode 100644 index 00000000..45201ff8 --- /dev/null +++ b/test/monniaux/ternary/ternary.c @@ -0,0 +1,23 @@ +#include <stdint.h> +#include <stdio.h> +#include <inttypes.h> +#include "../clock.h" + +typedef uint32_t data; + +data silly_computation(void) { + data x = 1; + for(int i=0; i<10000; i++) { + x = x * (((x & 0x100) != 0) ? 45561U : 337777U); + } + return x; +} + +int main() { + clock_prepare(); + clock_start(); + data result = silly_computation(); + clock_stop(); + printf("result=%" PRIu32 "\ncycles=%" PRIu64 "\n", result, get_total_clock()); + return 0; +} |