diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-11 19:26:27 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-11 19:26:27 +0200 |
commit | 9cdb61cc69db8fbb9bedfd3957b9512f8622fb7a (patch) | |
tree | 5052f6f144a507e84319386004b0ae433ccb8a35 /test | |
parent | b782b7fda32a910ca0f011f99c5b2864eaeb3e55 (diff) | |
download | compcert-kvx-9cdb61cc69db8fbb9bedfd3957b9512f8622fb7a.tar.gz compcert-kvx-9cdb61cc69db8fbb9bedfd3957b9512f8622fb7a.zip |
experiments on the meaning of sbmm8
Diffstat (limited to 'test')
-rw-r--r-- | test/monniaux/k1_builtins/sbmm8.c | 8 | ||||
-rwxr-xr-x | test/monniaux/k1_builtins/sbmm8_demo.sage | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/monniaux/k1_builtins/sbmm8.c b/test/monniaux/k1_builtins/sbmm8.c new file mode 100644 index 00000000..da1178dc --- /dev/null +++ b/test/monniaux/k1_builtins/sbmm8.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main() { + unsigned long a = 0x12345678ABCDEFUL, b=0x12345118ABCD32UL, c; + c = __builtin_k1_sbmm8(a, b); + printf("%lx\n", c); + return 0; +} diff --git a/test/monniaux/k1_builtins/sbmm8_demo.sage b/test/monniaux/k1_builtins/sbmm8_demo.sage new file mode 100755 index 00000000..45948668 --- /dev/null +++ b/test/monniaux/k1_builtins/sbmm8_demo.sage @@ -0,0 +1,16 @@ +#!/usr/bin/env sage +def mat_from_uint64(n): + return Matrix(GF(2), [[(n >> (i*8+j)) & 1 for j in range(8)] for i in range(8)]) + +def uint64_from_mat(m): + s = 0 + for i in range(8): + for j in range(8): + if m[i, j]: + s += 1 << (i*8 + j) + return s + +matA=mat_from_uint64(0x12345678ABCDEF) +matB=mat_from_uint64(0x12345118ABCD32) + +print hex(uint64_from_mat(matB * matA)) |