diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-14 11:03:28 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2021-01-14 11:03:28 +0100 |
commit | 1d265f0dd60797748d310ad84b2c4aef5ac22d3f (patch) | |
tree | 9be26109ad98b980243e366724a0435c84639847 /test | |
parent | 69b1b44c0b7761e0cb44cad747b36e12e5277cc1 (diff) | |
download | compcert-kvx-1d265f0dd60797748d310ad84b2c4aef5ac22d3f.tar.gz compcert-kvx-1d265f0dd60797748d310ad84b2c4aef5ac22d3f.zip |
generate a matrix product with many temporaries
Diffstat (limited to 'test')
-rw-r--r-- | test/monniaux/many_temporaries/matrix_product.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/monniaux/many_temporaries/matrix_product.py b/test/monniaux/many_temporaries/matrix_product.py new file mode 100644 index 00000000..911ca92c --- /dev/null +++ b/test/monniaux/many_temporaries/matrix_product.py @@ -0,0 +1,20 @@ +m=4 +n=5 +p=6 +number_type='double' +with open('matrix_product.c', 'w') as cfile: + cfile.write(f'void matrix_product({number_type} c[{m}][{p}], const {number_type} a[{m}][{n}], const {number_type} b[{n}][{p}]) {{\n') + for i in range(m): + for j in range(n): + for k in range(p): + cfile.write(f' const {number_type} p_{i}_{j}_{k} = a[{i}][{j}] * b[{j}][{k}];\n') + for i in range(m): + for k in range(p): + cfile.write(f' c[{i}][{k}] = ') + for j in range(n): + if j>0: + cfile.write(' + ') + cfile.write(f'p_{i}_{j}_{k}') + cfile.write(';\n') + cfile.write('}\n') + |