div, divhu, divu


-

The div, divhu, and divu instructions of the device should be specified in the following formats.

-

DIV   reg1, reg2, reg3

-

DIVHU reg1, reg2, reg3

-

DIVU   reg1, reg2, reg3

 

-

In asrh, the following formats can also be used in addition to the above.

-

div imm, reg2, reg3

-

divhu imm, reg2, reg3

-

divu imm, reg2, reg3

 

-

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

(a)

0

div     0, reg2, reg3
div     r0, reg2, reg3

(b)

Absolute expression having a value of other than 0 within the range of -16 to +15

div     imm5, reg2, reg3
mov     imm5, r1
div     r1, reg2, reg3

(c)

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

div     imm16, reg2, reg3
movea   imm16, r0, r1
div     r1, reg2, reg3

(d)

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

div     imm, reg2, reg3
movhi   HIGHW(imm), r0, r1
div     r1, reg2, reg3

 

Else

div     imm, reg2, reg3
mov     imm, r1
div     r1, reg2, reg3

(e)

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

div     !label, reg2, reg3
movea   !label, r0, r1
div     r1, reg2, reg3
div     #label, reg2, reg3
movea   #label, r0, r1
div     r1, reg2, reg3
div     $label, reg2, reg3
movea   $label, r0, r1
div     r1, reg2, reg3

(f)

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

div     #label, reg2, reg3
mov     #label, r1
div     r1, reg2, reg3
div     label, reg2, reg3
mov     label, r1
div     r1, reg2, reg3
div     $label, reg2, reg3
mov     $label, r1
div     r1, reg2, reg3