satsubi


Subtracts saturated (immediate).

[Syntax]

-

satsubi imm, reg1, reg2

 

The following can be specified for imm:

-

Absolute expression having a value of up to 32 bits

-

Relative expression

-

Either of the above expressions with HIGHW, LOWW, or HIGHW1 applied

[Function]

Subtracts the value of the absolute expression, relative expression, or expression with HIGHW, LOWW, or HIGHW1 applied specified by the first operand from the value of the register specified by the second operand, and stores the result in the register specified by the third operand. If the result exceeds the maximum positive value of 0x7FFFFFFF, however, 0x7FFFFFFF is stored in the register specified by the third operand. Likewise, if the result exceeds the maximum negative value of 0x80000000, 0x80000000 is stored in the register specified by the third operand. In both cases, the SAT flag is set to 1.

[Description]

-

If the following is specified for imm, the assembler generates one satsubi machine instructionNote.

(a)

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

satsubi imm16, reg1, reg2
satsubi imm16, reg1, reg2

(b)

Relative expression having $label for a label having a definition in the sdata/sbss-attribute section

satsubi $label, reg1, reg2
satsubi $label, reg1, reg2

(c)

Relative expression having !label or %label

satsubi !label, reg1, reg2
satsubi !label, reg1, reg2
satsubi %label, reg1, reg2
satsubi %label, reg1, reg2

(d)

Expression with HIGHW, LOWW, or HIGHW1

satsubi imm16, reg1, reg2
satsubi imm16, reg1, reg2

Note

The satsubi machine instruction takes an immediate value, in the range of -32,768 to +32,767 (0xFFFF8000 to 0x7FFF), as the first operand.

 

-

If the following is specified for imm, the assembler executes instruction expansion to generate multiple machine instructions.

(a)

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

<1>

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

If reg2 is the same as reg1

satsubi imm, reg1, reg2
movhi   HIGHW(imm), r0, r1
satsub  r1, r2

Else

satsubi imm, reg1, reg2
movhi   HIGHW(imm), r0, reg2
satsubr reg1, reg2

<2>

Else

If reg2 is the same as reg1

satsubi imm, reg1, reg2
mov     imm, r1
satsub  r1, reg2

Else

satsubi imm, reg1, reg2
mov     imm, reg2
satsubr reg1, reg2

(b)

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

If reg2 is the same as reg1

satsubi #label, reg1, reg2
mov     #label, r1
satsub  r1, reg2
satsubi label, reg1, reg2
mov     label, reg2
satsub  r1, reg2
satsubi $label, reg1, reg2 
mov     $label, reg2
satsub  r1, reg2

Else

satsubi #label, reg1, reg2
mov     #label, reg2
satsubr reg1, reg2
satsubi label, reg1, reg2
mov     label, reg2
satsubr reg1, reg2
satsubi $label, reg1, reg2 
mov     $label, reg2
satsubr reg1, reg2

[Flag]

CY

1 if a borrow occurs from MSB (Most Significant Bit), 0 if not

OV

1 if Integer-Overflow occurs, 0 if not

S

1 if the result is negative, 0 if not

Z

1 if the result is 0, 0 if not

SAT

1 if OV = 1, - if not

[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).