add
Group: arithmetic
Performs arithmetic addition. Both operand numbers can be of different types, type of result is determined by result type specifier.
(0) add r0 r1 r2
(1) add r0 r1
(0)
is the canonical form.
Assembler expands (1)
to "add r0 r0 r1".
add %1 local %2 local
-- expands to...
add %1 local %1 local %2 local
Adds number in "Rhs" to number in "Lhs" and stores the result in "Output". Type of the result is determined by the type of Lhs operand's value. Input operands are signed integers or floating point numbers.
Exception is thrown when either input operand has invalid (non-numeric) type.
.function: example/0
-- store 39 in local register 1
istore %1 local 39
-- store 3 in local register 1
istore %2 local 3
-- result of add will be stored in "%3 local"
-- its type will be a 64 bit signed integer
add int64 %3 local %1 local %2 local
-- prints "42" to stdout
print %3 local
return
.end