Intel 253666-024US User Manual

Page 500

Advertising
background image

3-454 Vol. 2A

IDIV—Signed Divide

INSTRUCTION SET REFERENCE, A-M

Operation

IF SRC

=

0

THEN #DE; (* Divide error *)

FI;

IF OperandSize

=

8 (* Word/byte operation *)

THEN

temp ← AX / SRC; (* Signed division *)

IF (temp > 7FH) or (temp < 80H)

(* If a positive result is greater than 7FH or a negative result is less than 80H *)

THEN #DE; (* Divide error *)
ELSE

AL ← temp;

AH ← AX SignedModulus SRC;

FI;

ELSE IF OperandSize

=

16 (* Doubleword/word operation *)

THEN

temp ← DX:AX / SRC; (* Signed division *)

IF (temp > 7FFFH) or (temp < 8000H)

(* If a positive result is greater than 7FFFH
or a negative result is less than 8000H *)

THEN

#DE; (* Divide error *)

ELSE

AX ← temp;

DX ← DX:AX SignedModulus SRC;

FI;

FI;

ELSE IF OperandSize = 32 (* Quadword/doubleword operation *)

temp ← EDX:EAX / SRC; (* Signed division *)

IF (temp > 7FFFFFFFH) or (temp < 80000000H)

(* If a positive result is greater than 7FFFFFFFH
or a negative result is less than 80000000H *)

Table 3-55. IDIV Results

Operand Size

Dividend

Divisor

Quotient

Remainder

Quotient Range

Word/byte

AX

r/m8

AL

AH

−128 to +127

Doubleword/word

DX:AX

r/m16

AX

DX

−32,768 to +32,767

Quadword/doubleword

EDX:EAX

r/m32

EAX

EDX

−2

31

to 2

32

− 1

Doublequadword/

quadword

RDX:RAX

r/m64

RAX

RDX

−2

63

to 2

64

− 1

Advertising