On this page:
3.1 Registers
v0
v1
v2
r0
r1
r2
f0
f1
f2
f3
f4
f5
fp
3.2 Arithmetic
3.3 Comparisons
3.4 Branches
3.5 Function calls
3.6 Other
7.7

3 Generic Instructions

 (require asm/generic) package: asm
Based on the GNU lightning instruction set, with some differences.

3.1 Registers

value

v0 : register?

value

v1 : register?

value

v2 : register?

Callee-saved registers.

value

r0 : register?

value

r1 : register?

value

r2 : register?

Caller-saved registers.

value

f0 : register?

value

f1 : register?

value

f2 : register?

value

f3 : register?

value

f4 : register?

value

f5 : register?

Floating-point registers.

value

fp : register?

Frame pointer.

3.2 Arithmetic

Can any scribble experts think of a nice way of documenting all these functions without a load of typing?

;; Binary ALU operations

add addx addc sub subx subc rsb mul div rem and or xor lsh rsh

;; Four operand binary ALU operations

qmul qdiv

;; Unary ALU operations

neg com abs sqrt

3.3 Comparisons

lt le gt ge eq ne unlt unle ungt unge uneq ltgt ord unord

3.4 Branches

blt ble bgt bge beq bne bunlt bunle bungt bunge buneq bltgt bord bunord bms bmc boadd bxadd bosub bxsub

3.5 Function calls

;; Function calls

prepare pusharg call finish jmp retval

arg getarg putarg prolog epilog alloca ret frame tramp

3.6 Other

;; Transfer operations

mov ext trunc

;; Network extensions

hton ntoh

;; Load operations

ld ldx

;; Store operations

st stx