add, mulh


-

The add and mulh instructions of the device should be specified in the following formats.

-

ADD reg1, reg2

-

ADD imm5, reg2

-

MULH reg1, reg2

-

MULH imm5, reg2

 

-

If the following is specified for imm in syntax "add imm, reg2" and "mulh imm, reg2", the assembler executes instruction expansion to generate one or more machine instructions.

(a)

Absolute expression exceeding the range of -16 to +15, but within the range of -32,768 to +32,767

add     imm16, reg
addi    imm16, reg, reg

(b)

Absolute expression having a value exceeding the range of -32,768 to +32,767

If all the lower 16 bits of the value of imm are 0

add     imm, reg
movhi   HIGHW(imm), r0, r1
add     r1, reg

 

Else

add     imm, reg
mov     imm, r1
add     r1, reg

(c)

Relative expression having !label or %label, or that having $label for a label with a definition in the sdata/sbss-attribute section

add     !label, reg
addi    !label, reg, reg
add     %label, reg
addi    %label, reg, reg
add     $label, reg
addi    $label, reg, reg

(d)

Relative expression having #label or label, or that having $label for a label having no definition in the sdata/sbss-attribute section

add     #label, reg
mov     #label, r1
add     r1, reg
add     label, reg
mov     label, r1
add     r1, reg
add     $label, reg
mov     $label, r1
add     r1, reg