AN2203 Freescale Semiconductor / Motorola, AN2203 Datasheet - Page 54

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
Comparisons and Comparisons Against Zero
5.2
Table 5-2 shows the code sequences from Section D.1 of the PowerPC Compiler Writer’s Guide. In each
example, v0 is located in r3 and v1 is located in r4.
54
eq
r = (v0 == v1)
ne
r = (v0 != v1)
les/ges
(r = (signed_word) v0 <= (signed_word) v1)
(r = (signed_word) v1>= (signed_word) v0)
leu/geu
r = (unsigned_word) v0 <= (unsigned_word) v1
r = (unsigned_word) v1 >= (unsigned_word) v0;
lts/gts
r = (signed_word) v0 < (signed_word ) v;
r = (signed_word) v1 > (signed_word) v0;
Comparisons and Comparisons Against Zero
MPC7450 RISC Microprocessor Family Software Optimization Guide
Operation
Table 5-2. Comparisons and Comparisons Against Zero
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
subf r5,r3,r4
cntlzw r6,r5
srwi r7,r6,5
Cycles: 3
subf r5,r3,r4
addic r6,r5,-1
subfe r7,r6,r5
Cycles: 5
srwi r5,r3,31
srawi r6,r4,31
subfc r7,r3,r4
adde r8,r6,r5
Cycles: 5
li r6,-1
subfc r5,r3,r4
subfze r7,r6
Cycles: 4
subfc r5,r4,r3
eqv r6,r4,r3
srwi r7,r6,31
addze r8,r7
rlwinm r9,r8,0,31,31
Cycles: 6
Compiler Writer’s
Guide Code
subf r5,r3,r4
subf r6,r4,r3
or r7,r6,r5
srwi r8,r7,31
Cycles: 3
srawi r6,r4,31
subfc r7,r3,r4
srwi r5,r3,31
adde r8,r6,r5
Cycles: 5
subf r5,r3,r4
orc r7,r4,r3
srwi r6,r5,1
subf r8,r6,r7
srwi r9,r8,31
Cycles: 4
xor r5,r4,r3
srawi r6,r5,31
or r7,r6,r3
subf r8,r4,r7
srwi r9,r8,31
Cycles: 5
MPC7450 Code
(If Different)
The MPC7450
sequence avoids the
execution-serializing
addic and subfe
pair. Additionally, the
first 2 instructions
may execute in
parallel in the 2
integer units.
The MPC7450
sequence reorders
the instructions to
increase the
likelihood of better
performance in
real-world scenarios
and on future
processors.
With good scheduling
and register
allocation, the
MPC7450 sequence
is more likely to
perform well on future
processors. If
instruction cache
usage or register
usage is an issue, the
PowerPC Compiler
Writer’s Guide
sequence is
preferred.
Comments
MOTOROLA

Related parts for AN2203