AN2203 Freescale Semiconductor / Motorola, AN2203 Datasheet - Page 26

no-image

AN2203

Manufacturer Part Number
AN2203
Description
MPC7450 RISC Microprocessor Family Software Optimization Guide
Manufacturer
Freescale Semiconductor / Motorola
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN22030A
Manufacturer:
PANASONIC/松下
Quantity:
20 000
Dispatch Considerations
Assume r6 holds the address of SWITCH_TABLE for the following assembly code:
Function pointers and virtual function calls should also use the CTR for their indirection, to avoid corrupting
the hardware link stack. The following example shows a typical indirect function call. Note that the CTR is
used to hold the target address, and the link form of the branch (bctrl) is used to save the return address.
Source code in C:
Assume r9 holds the address of funcptr for the following assembly code:
3.1.5
Branches that do not set the LR or update the CTR are eligible for folding. In all three architectures, taken
branches are folded immediately. For MPC750 or MPC7400, non-taken branches are folded at dispatch. In
the MPC7450, not-taken branches cannot be fall-through folded if they are in IQ0–IQ2; however, branches
are removed in the cycle after execution if they are in IQ3–IQ7.
3.2
The following is a list of resources required for MPC7450 to avoid stalls in the dispatch unit (IQ0–IQ2 are
the three dispatch entries in the instruction queue):
The following sections describe how to optimize code for dispatch.
3.2.1
MPC7450 can dispatch a maximum throughput of three instructions per cycle. The dispatch process
includes a CQ available check, an issue queue available check, a branch ready check, and a rename check.
26
The appropriate issue queue is available.
The CQ is not full.
Previous instructions in the IQ must dispatch. For example, IQ0 must dispatch for IQ1 to be able to
dispatch.
Needed rename registers are available.
}
lwz
slwi
lwzx
mtctr
bctr
extern int (*funcptr)();
...
a = funcptr();
lwz
mtctr
bctrl
Dispatch Considerations
Branch Folding
Dispatch Groupings
MPC7450 RISC Microprocessor Family Software Optimization Guide
r4,x
r4, r4, 2
r5, r4, r6
r5
r0, 0(r9)
r0
Freescale Semiconductor, Inc.
For More Information On This Product,
break;
Go to: www.freescale.com
# Load the value at funcptr.
# Move it to the CTR.
# Perform indir. branch, save return address.
# Multiply by 4 to create word index.
# r5 = SWITCH_TABLE[r4].
# Move r5 to CTR.
# Perform indirect branch.
MOTOROLA

Related parts for AN2203