mulh


Multiplies half-word.

[Syntax]

-

mulh reg1, reg2

-

mulh imm, reg2

 

The following can be specified for imm:

-

Absolute expression having a value of up to 16 bitsNote

-

Relative expression

Note

The assembler does not check whether the value of the expression exceeds 16 bits. The generated mulh instruction performs the operation by using the lower 16 bits.

[Function]

-

Syntax "mulh reg1, reg2"

Multiplies the value of the lower halfword data of the register specified by the first operand by the value of the lower halfword data of the register specified by the second operand as a signed value, and stores the result in the register specified by the second operand.

-

Syntax "mulh imm, reg2"

Multiplies the value of the lower halfword data of the absolute expression or relative expression specified by the first operand by the value of the lower halfword data of the register specified by the second operand as a signed value, and stores the result in the register specified by the second operand.

[Description]

-

If the instruction is executed in syntax "mulh reg1, reg2", the assembler generates one mulh machine instruction.

-

If the following is specified as imm in syntax "mulh imm, reg2", the assembler generates one mulh machine instructionNote.

(a)

Absolute expression having a value in the range of -16 to +15

mulh    imm5, reg
mulh    imm5, reg

Note

The mulh machine instruction takes a register or immediate value in the range of -16 to +15 (0xFFFFFFF0 to 0xF) as the first operand.

 

-

If the following is specified for imm in syntax "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

mulh    imm16, reg
mulhi   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

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

Else

mulh    imm, reg
mov     imm, r1
mulh    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

mulh    !label, reg
mulhi   !label, reg, reg
mulh    %label, reg
mulhi   %label, reg, reg
mulh    $label, reg
mulhi   $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

mulh    #label, reg
mov     #label, r1
mulh    r1, reg
mulh    label, reg
mov     label, r1
mulh    r1, reg
mulh    $label, reg
mov     $label, r1
mulh    r1, reg

[Flag]

CY

---

OV

---

S

---

Z

---

SAT

---

[Caution]

-

If r0 is specified by the second operand, the assembler outputs the following message and stops assembling.

E0550240 : Illegal operand (cannot use r0 as destination in RH850 mode).