The Cro Field - IBM PowerPC 405GP User Manual

Embedded processor
Table of Contents

Advertisement

3.3.3.2
The CRO Field
After the execution of compare instructions that update CR[CRO], CR[CRO] is interpreted as
described in "CR Fields after Compare Instructions" on page 3-13. The "dot" forms of arithmetic and
logical instructions also alter CR[CRO]. After most instructions that update CR[CRO], the bits of CRO
are interpreted as follows:
LT (bit 0)
GT
(bit
1)
EO (bit 2)
SO (bit 3)
Less than 0; set if the most-significant bit of the 32-bit result is 1.
Greater than 0; set if the 32-bit result is non-zero and the most-
significant bit of the result is O.
Equal to 0; set if the 32-bit result is O.
Summary overflow; a copy of XER[SO] at instruction completion.
The CR[CROkT, GT, EO subfields are set as the result of an algebraic comparison of the instruction
. result to 0, regardless of the type of instruction that sets CR[CRO]. If the instruction result is 0, the EO
subfield is set to 1. If the result is not 0, either LT or GT is set, depending on the value of the most-
significant bit of the result.
When updating CR[CRO], the most significant bit of an instruction result is considered a sign bit, even
for instructions that produce results that are not usually thought of as signed. For example, logical
instructions such as and., or., and nor. update CR[CROkT, GT, EO using such an arithmetic comparison
to 0, although the result of such a logical operation is not actually an arithmetic result.
If an arithmetic overflow occurs, the "sign" of an instruction result indicated in CR[CRO]LT, GT, EO might
not represent the "true" (infinitely precise) algebraic result of the instruction that set CRO. For
example, if an add. instruction adds two large positive numbers and the magnitude of the result
cannot be represented as a twos-complement number in a 32-bit register, an overflow occurs and
CR[CROkT, so are set, although the infinitely precise result of the add is positive.
Adding the largest 32-bit twos-complement negative number, Ox8000 0000, to itself results in an
arithmetic overflow and OxOOOO 0000 is recorded in the target register. CR[CRO]EO, so is set,
indicating a result of 0, but the infinitely precise result is negative.
The CR[CROls o subfield is a copy of XER[SO]. Instructions that do not alter the XER[SO] bit cannot
cause an overflow, but even for these instructions CR[CROls o is a copy of XER[SO].
Some instructions set CR[CRO] differently or do not specifically set any of the subfields. These
instructions include:
• Compare instructions
cmp, cmpi, cmpl, cmpli
• CR logical instructions
crand, crandc, creqv, crnand, crnor, cror, crorc, crxor, mcrf
• Move
CR instructions
mterf, mcrxr
• stwcx.
The instruction descriptions provide detailed information about how the listed instructions alter
CR[CRO].
3-14
PPC405GP User's Manual
Preliminary

Advertisement

Table of Contents
loading

Table of Contents