14.06.2015 Views

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

Power ISA™ Version 2.03 - Power.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Version</strong> <strong>2.03</strong><br />

Chapter 4. Branch Operation Instructions<br />

4.1 Branch Processor Registers. . . . . 653<br />

4.1.1 Condition Register (CR). . . . . . . 653<br />

4.1.1.1 Condition Register Setting for<br />

Compare Instructions . . . . . . . . . . . . . 654<br />

4.1.1.2 Condition Register Setting for the<br />

Bit Test Instruction. . . . . . . . . . . . . . . . 654<br />

4.1.2 Link Register (LR) . . . . . . . . . . . 654<br />

4.1.3 Count Register (CTR) . . . . . . . . 654<br />

4.2 Branch Instructions . . . . . . . . . . . . 655<br />

4.3 System Linkage Instructions . . . . . 658<br />

4.4 Condition Register Instructions . . . 661<br />

This section defines Branch instructions that can be<br />

executed when a processor is in VLE mode and the<br />

registers that support them.<br />

4.1 Branch Processor Registers<br />

The registers that support branch operations are:<br />

Section 4.1.1, “Condition Register (CR)”<br />

Section 4.1.2, “Link Register (LR)”<br />

Section 4.1.3, “Count Register (CTR)”<br />

4.1.1 Condition Register (CR)<br />

The Condition Register (CR) is a 32-bit register which<br />

reflects the result of certain operations, and provides a<br />

mechanism for testing (and branching). The CR is<br />

more fully defined in Book I.<br />

Category VLE uses the entire CR, but some comparison<br />

operations and all Branch instructions are limited to<br />

using CR0–CR3. The full Book I condition register field<br />

and logical operations are provided however.<br />

CR<br />

32 63<br />

Figure 17. Condition Register<br />

The bits in the Condition Register are grouped into<br />

eight 4-bit fields, CR Field 0 (CR0) ... CR Field 7 (CR7),<br />

which are set by VLE defined instructions in one of the<br />

following ways.<br />

Specified fields of the condition register can be set<br />

by a move to the CR from a GPR (mtcrf, mtocrf).<br />

A specified CR field can be set by a move to the<br />

CR from another CR field (e_mcrf) or from<br />

XER 32:35 (mcrxr).<br />

CR field 0 can be set as the implicit result of a<br />

fixed-point instruction.<br />

A specified CR field can be set as the result of a<br />

fixed-point compare instruction.<br />

CR field 0 can be set as the result of a fixed-point<br />

bit test instruction.<br />

Other instructions from implemented categories may<br />

also set bits in the CR in the same manner that they<br />

would when not in VLE mode.<br />

Instructions are provided to perform logical operations<br />

on individual CR bits and to test individual CR bits.<br />

For all fixed-point instructions in which the Rc bit is<br />

defined and set, and for e_add2i., e_and2i.,and<br />

e_and2is., the first three bits of CR field 0 (CR 32:34 ) are<br />

set by signed comparison of the result to zero, and the<br />

fourth bit of CR field 0 (CR 35 ) is copied from the final<br />

state of XER SO . “Result” here refers to the entire 64-bit<br />

value placed into the target register in 64-bit mode, and<br />

to bits 32:63 of the value placed into the target register<br />

in 32-bit mode.<br />

if (64-bit mode)<br />

then M 0<br />

else M 32<br />

if (target_register) M:63 < 0 then c 0b100<br />

else if (target_register) M:63 > 0 then c 0b010<br />

else<br />

c 0b001<br />

CR0 c || XER SO<br />

If any portion of the result is undefined, the value<br />

placed into the first three bits of CR field 0 is undefined.<br />

The bits of CR field 0 are interpreted as shown below.<br />

CR Bit Description<br />

32 Negative (LT)<br />

The result is negative.<br />

33 Positive (GT)<br />

The result is positive.<br />

34 Zero (EQ)<br />

The result is 0.<br />

Chapter 4. Branch Operation Instructions<br />

653

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!