diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-03 08:17:40 +0100 |
commit | 1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68 (patch) | |
tree | 210ffc156c83f04fb0c61a40b4f9037d7ba8a7e1 /test/monniaux/ternary | |
parent | 222c9047d61961db9c6b19fed5ca49829223fd33 (diff) | |
parent | 12be46d59a2483a10d77fa8ee67f7e0ca1bd702f (diff) | |
download | compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.tar.gz compcert-kvx-1ab7b51c30e1b10ac45b0bd64cefdc01da0f7f68.zip |
Merge branch 'mppa-cse2' of gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-work
Diffstat (limited to 'test/monniaux/ternary')
-rw-r--r-- | test/monniaux/ternary/make.proto | 2 | ||||
-rw-r--r-- | test/monniaux/ternary/ternary.c | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/monniaux/ternary/make.proto b/test/monniaux/ternary/make.proto new file mode 100644 index 00000000..1568ed07 --- /dev/null +++ b/test/monniaux/ternary/make.proto @@ -0,0 +1,2 @@ +target: ternary +measures: [cycles] diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c new file mode 100644 index 00000000..e8813a5c --- /dev/null +++ b/test/monniaux/ternary/ternary.c @@ -0,0 +1,24 @@ +#include <stdint.h> +#include <stdio.h> +#include <inttypes.h> +#include "../clock.h" +#include "../ternary.h" + +typedef uint32_t data; + +data silly_computation(void) { + data x = 1; + for(int i=0; i<10000; i++) { + x = x * TERNARY32(x & 0x100, 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; +} |