divw
Divide Word
Preliminary
PPC440x5 CPU Core User’s Manual
instrset.fm.
September 12, 2002
Page 307 of 589
divw
Divide Word
(RT)
←
(RA)
÷
(RB)
The contents of register RA are divided by the contents of register RB. The quotient is placed into register RT.
Both the dividend and the divisor are interpreted as signed integers. The quotient is the unique signed integer
that satisfies:
dividend = (quotient
×
divisor) + remainder
where the remainder has the same sign as the dividend and its magnitude is less than that of the divisor.
If an attempt is made to perform (0x8000 0000
÷
–1) or (
n
÷
0), the contents of register RT are undefined; if
the Rc field also contains 1, the contents of CR[CR0]
0:2
are undefined. Either invalid division operation sets
XER[OV, SO] (and CR[CR0]
3
if Rc contains 1) to 1 if the OE field contains 1.
Registers Altered
• RT
• CR[CR0] if Rc contains 1
• XER[OV, SO] if OE contains 1
Programming Note
The 32-bit remainder can be calculated using the following sequence of instructions:
divw
RT,RA,RB
# RT = quotient
mullw
RT,RT,RB
# RT = quotient
×
divisor
subf
RT,RT,RA
# RT = remainder
The sequence does not calculate correct results for the invalid divide operations.
divw
RT, RA, RB
OE=0, Rc=0
divw.
RT, RA, RB
OE=0, Rc=1
divwo
RT, RA, RB
OE=1, Rc=0
divwo.
RT, RA, RB
OE=1, Rc=1
31
RT
RA
RB
OE
491
Rc
0
6
11
16
21 22
31
Содержание PPC440X5 CPU Core
Страница 1: ...PPC440x5 CPU Core User s Manual Preliminary SA14 2613 02 September 12 2002 Title Page...
Страница 22: ...User s Manual PPC440x5 CPU Core Preliminary Page 22 of 583 ppc440x5LOT fm September 12 2002...
Страница 26: ...User s Manual PPC440x5 CPU Core Preliminary Page 26 of 589 preface fm September 12 2002...
Страница 38: ...User s Manual PPC440x5 CPU Core Preliminary Page 38 of 589 overview fm September 12 2002...
Страница 94: ...User s Manual PPC440x5 CPU Core Preliminary Page 94 of 589 init fm September 12 2002...
Страница 132: ...User s Manual PPC440x5 CPU Core Preliminary Page 132 of 589 cache fm September 12 2002...
Страница 158: ...User s Manual PPC440x5 CPU Core Preliminary Page 158 of 589 mmu fm September 12 2002...
Страница 218: ...User s Manual PPC440x5 CPU Core Preliminary Page 218 of 589 timers fm September 12 2002...
Страница 248: ...User s Manual PPC440x5 CPU Core Preliminary Page 248 of 589 debug fm September 12 2002...
Страница 458: ...User s Manual PPC440x5 CPU Core Preliminary Page 458 of 589 regsummIntro fm September 12 2002...
Страница 568: ...User s Manual PPC440x5 CPU Core Preliminary Page 568 of 589 instalfa fm September 12 2002...
Страница 588: ...User s Manual PPC440x5 CPU Core Preliminary Page 588 of 583 ppc440x5IX fm September 12 2002...
Страница 590: ......