AN2203 Freescale Semiconductor / Motorola, AN2203 Datasheet - Page 21

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
the misprediction causes the outer loop code to be dispatched in cycle 13. If the branch had been correctly
predicted as not taken, these instructions would have dispatched five cycles earlier in cycle 8.
Table 3-6 shows this example transformed when using CTR for the inner loop.
The following code uses the CTR, which shortens the loop because the compare test (done by the addic. at
xxxxxx20 in the previous code example) is combined into the bdnz branch. Note that in the previous
example, the outer loop required an addi/cmpi sequence to save the compare results into CRF1, rather than
an addic., since the inner loop used CRF0. In the example below, as the inner loop no longer uses CRF0,
the outer loop compare code can be simplified to just an addic. instruction.
xxxxxx1C
xxxxxx20
xxxxxx24
xxxxxx28
xxxxxx2C
xxxxxx30
xxxxxx34
xxxxxx38
MOTOROLA
addi
cmp
addic (1)
lwzu (1)
add (1)
bne (1)
addic. (2)
lwzu (2)
add (2)
bne (2)
addic. (3)
lwzu (3)
add (3)
bne (3)
addic. (4)
lwzu (4)
add (4)
bne (4)
stwu
xor
ori
bne
Instruction
outer_loop: addic. r6,r6,#FFFF
inner_loop: lwzu r10,0x4(r9)
MPC7450 RISC Microprocessor Family Software Optimization Guide
F2
F2
F2
F2
D
D
0
BE
D
D
D
1
I
I
Freescale Semiconductor, Inc.
For More Information On This Product,
add r11,r11,r10
bdnz inner_loop
mtctr r7
stwu r11,0x4(r8)
xor r11,r11,r11
bne 0,outer_loop
Table 3-6. Three Iterations of Code Loop
E
2
I
I
I
BE
E0
C
D
D
D
E
E
3
Go to: www.freescale.com
E1
C
C
4
I
I
I
BE
E2
E0
E
D
D
D
5
E1
C
E
6
I
I
I
BE
E2
E0
C
C
D
D
D
E
7
E1
C
8
E
I
I
I
E2
E0
C
C
E
9
Fetch/Branch Considerations
E1
10
M
C
E
E2
F1
F1
F1
F1
11
C
C
12
F2
F2
F2
F2
C
E
BE
13
C
D
D
D
14
I
I
I
21

Related parts for AN2203