L1VM - move assign

I did add a new way to assign integer and double numbers: m=. This will add the faster move opcode in the place of the normal load and pull opcodes. It can be done if the variables are already in the registers. Let’s have a look at this example (it’s included in my GitHub repo):

// hello-move.l1com
//
//
#include <intr.l1h>
(main func)
    (set int64 1 zero 0)
    (set double 1 xd 23.0)
    (set double 1 yd 42.0)
    (set double 1 id 100.0)
    (set double 1 jd 88.5)
    (set double 1 ad 0.0)
    (set double 1 bd 0.0)
    (set double 1 cd 0.0)
    (set double 1 zd 0.0)
    (set double 1 zerod 0.0)
    (set int64 1 f 0)
    ((xd yd *d) ad =)
    ((id jd +d) bd =)
    (xd load)
    (xd id m=)
    print_d (id)
    print_n
    exit (zero)
(funcend)

Here we must insert one load opcode to load xd! The following (xd id m=) does the move assign into the register of id.

Here is the compiler output:

l1com output image

Here is the full assembly output:

.data
Q, 1, zero
@, 0Q, 0
F, 1, xd
@, 8Q, 23.0
F, 1, yd
@, 16Q, 42.0
F, 1, id
@, 24Q, 100.0
F, 1, jd
@, 32Q, 88.5
F, 1, ad
@, 40Q, 0.0
F, 1, bd
@, 48Q, 0.0
F, 1, cd
@, 56Q, 0.0
F, 1, zd
@, 64Q, 0.0
F, 1, zerod
@, 72Q, 0.0
Q, 1, f
@, 80Q, 0
.dend
.code
:main
loada zero, 0, 0
loadd xd, 0, 1
loadd yd, 0, 2
muld 1, 2, 1
load ad, 0, 3
pulld 1, 3, 0
loadd id, 0, 1
loadd jd, 0, 3
addd 1, 3, 2
load bd, 0, 4
pulld 2, 4, 0
loadd xd, 0, 2
movd 2, 1
intr0 5, 1, 0, 0
intr0 7, 0, 0, 0
intr0 255, 0, 0, 0
rts
.cend

Here the load and move opcode are here:

loadd xd, 0, 2
movd 2, 1