AN2203 Freescale Semiconductor / Motorola, AN2203 Datasheet - Page 57

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
5.4
Table 5-4 shows the code sequences from Section D.5 of the PowerPC Compiler Writer’s Guide. It is
assumed that there are three arguments for each operation. The v0 and v1 are the two arguments that are
used in the comparison and v2 is added depending on the result of the comparison. The register assumptions
MOTOROLA
nne0
r = -(v0 != 0)
nles0
r = -((signed_word) v0 <= 0);
nges0
r = -((signed_word) v1 >= 0);
nlts0
r = -((signed_word) v0 < 0)
ngts0
r = -((signed_word) v0 > 0)
Table 5-3. Negative Comparisons and Negative Comparisons Against Zero (continued)
Comparisons with Addition
MPC7450 RISC Microprocessor Family Software Optimization Guide
Operation
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
subfic r4,r3,0
subfe r5,r5,r5
Cycles: 4
addic r4,r3,-1
srwi r5,r3,31
subfze r6,r5
Cycles: 4
srwi r4,r3,31
addi r5,r4,-1
Cycles: 2
srawi r4,r3,31
Cycles: 1
subfic r4,r3,0
srwi r5,r3,31
addme r6,r5
Cycles: 4
Compiler Writer’s
Guide Code
neg r4,r3
or r5,r4,r3
srawi r6,r5,31
Cycles: 3
neg r4,r3
orc r5,r3,r4
srawi r6,r5,31
Cycles: 3
neg r4,r3
andc r5,r4,r3
srawi r6,r5,31
Cycles: 3
MPC7450 Code
(If Different)
Comparisons with Addition
The MPC7450
sequence takes 4
cycles to complete, but
the GPR result in r6 is
available after 3 cycles.
As this is the only part
of the result that is
used, the sequence is
assumed to take 3
cycles.
The MPC7450
sequence takes 4
cycles to complete, but
the GPR result in r6 is
available after 3 cycles.
As this is the only part
of the result that is
used, the sequence is
assumed to take 3
cycles.
The srawi produces a
GPR result in 1 cycle,
even though the
instruction does not
complete and produces
a carry until after 2
cycles. As the carry is
not used, the
instruction is assumed
to complete in 1 cycle.
The MPC7450
sequence takes 4
cycles to complete, but
the GPR result in r6 is
available after 3 cycles.
As this is the only part
of the result that is
used, the sequence is
assumed to take 3
cycles.
Comments
57

Related parts for AN2203