L1VM - benchmark 03
L1VM - benchmark 03
I did run the double floating point benchmark on my Lenovo L340: core i5 9th gen:
C program executed direct
=========================
$ time ./double-test
704000000001.000000
real 0m23,827s
user 0m23,802s
sys 0m0,001s
L1VM - JIT-compiler
===================
$ time l1vm jit-test-double-2 -q
704000000001.0000000000
real 0m27,545s
user 0m27,458s
sys 0m0,002s
L1VM - interpreter
==================
$ time l1vm jit-test-double-2-nojit -q
704000000001.0000000000
real 0m54,308s
user 0m54,077s
sys 0m0,018s
As you can see the JIT-compiler does a good job! And the L1VM is close to optimized C code: “-O3” flag was set to optimize the C code!
Here is the archive with all programs included: L1VM-benchmark-double-03
Here is the L1VM benchmark program. It just counts double floating point numbers in a loop. The JIT-compiler assembles the code between label “:jit” and “:jit_end”. You can see the “addd” instructions there!
// jit-test-double-2.l1com
(main func)
(set int64 1 zero 0)
(set double 1 x 23.0)
(set double 1 y 42.0)
(set double 1 z 7.0)
(set double 1 a 1.0)
(set int64 1 max 800000000Q)
(set int64 1 one 1)
(ASM)
loada zero, 0, I0
loadd x, 0, F1
loadd y, 0, F2
loadd z, 0, F3
loadd a, 0, F4
loadd a, 0, F10
loadd y, 0, F22
loadd x, 0, F20
loada one, 0, I4
loada max, 0, I5
loada one, 0, I6
loadl :jit, I40
loadl :jit_end, I41
// run jit compiler
intr0 253, I40, I41, 0
:loop
// call jit code
intr0 254, I0, 0, 0
// jump to following non-jit code
jmp :next
:jit
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F20, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F22, F10
addd F10, F22, F10
:jit_end
addd F10, F22, F10
// store
:next
// intr0 5, F10, 0, 0
// intr0 7, 0, 0, 0
addi I4, I6, I4
lseqi I4, I5, I30
jmpi I30, :loop
intr0 5, F10, 0, 0
intr0 7, 0, 0, 0
intr0 255, 0, 0, 0
(ASM_END)
(funcend)