mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +01:00
Add benchmark/matmul.fs
This commit is contained in:
parent
cfc1cb81a0
commit
dfffc47d16
2 changed files with 34 additions and 0 deletions
|
@ -44,3 +44,4 @@ echo "# Benchmarks"
|
|||
|
||||
generate-table "Bootstrap Time" "./planck < bootstrap.fs benchmark/nop.fs" 1
|
||||
generate-table "Fib(30)" "./planck < bootstrap.fs benchmark/fib.fs" 1
|
||||
generate-table "Matmul" "./planck < bootstrap.fs benchmark/matmul.fs" 1
|
||||
|
|
33
benchmark/matmul.fs
Normal file
33
benchmark/matmul.fs
Normal file
|
@ -0,0 +1,33 @@
|
|||
60 constant M
|
||||
90 constant K
|
||||
60 constant N
|
||||
|
||||
M K * cells allocate throw constant mat1
|
||||
K N * cells allocate throw constant mat2
|
||||
M N * cells allocate throw constant mat3
|
||||
|
||||
:noname
|
||||
M 0 do
|
||||
K 0 do
|
||||
i j + 1+ mat1 K j * i + cells + !
|
||||
loop
|
||||
loop
|
||||
|
||||
K 0 do
|
||||
N 0 do
|
||||
i j + 1+ mat2 N j * i + cells + !
|
||||
loop
|
||||
loop
|
||||
|
||||
M 0 do
|
||||
N 0 do
|
||||
0
|
||||
K 0 do
|
||||
mat1 K k * i + cells + @
|
||||
mat2 N i * j + cells + @
|
||||
* +
|
||||
loop
|
||||
mat3 N i * j + cells + !
|
||||
loop
|
||||
loop
|
||||
; execute
|
Loading…
Reference in a new issue