Intel® PXA27x Processor Family
Optimization Guide
4-5
Intel XScale® Microarchitecture & Intel® Wireless MMX™ Technology Optimization
•
Cost of using branches:
Users get better performance by using branch instructions in this scenario.
4.2.3
Optimizing Complex Expressions
Using conditional instructions improves the code generated for complex expressions such as the C
shortcut evaluation feature. The use of conditional instructions in this fashion improves
performance by minimizing the number of branches, thereby minimizing the penalties caused by
branch misprediction.
int foo(int a, int b){
if (a!= 0 && b!= 0)
return 0;
else
return 1;
}
The optimized code for the
if
condition is:
cmp r0, #0
cmpne r1, #0
Similarly, the code generated for this C segment:
int foo(int a, int b){
if (a!= 0 || b!= 0)
return 0;
else
return 1;
}
is:
cmp r0, #0
cmpeq r1, #0
This approach also reduces the utilization of branch prediction resources.
1
50
100
--------- 7
×
50
100
--------- 6
×
50
100
--------- 4
×
+
+
+
9.5
=
cycles
Summary of Contents for PXA270
Page 1: ...Order Number 280004 001 Intel PXA27x Processor Family Optimization Guide April 2004...
Page 10: ...x Intel PXA27x Processor Family Optimization Guide Contents...
Page 20: ...1 10 Intel PXA27x Processor Family Optimization Guide Introduction...
Page 30: ...2 10 Intel PXA27x Processor Family Optimization Guide Microarchitecture Overview...
Page 48: ...3 18 Intel PXA27x Processor Family Optimization Guide System Level Optimization...
Page 114: ...5 16 Intel PXA27x Processor Family Optimization Guide High Level Language Optimization...
Page 122: ...6 8 Intel PXA27x Processor Family Optimization Guide Power Optimization...
Page 143: ...Intel PXA27x Processor Family Optimization Guide Index 5 Index...
Page 144: ......