Intel Computer Hardware 80200 Manuel d'utilisateur Page 240

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 289
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 239
B-12 March, 2003 Developers Manual
Intel
®
80200 Processor based on Intel
®
XScale
Microarchitecture
Optimization Guide
B.3.1.3. Optimizing Complex Expressions
Conditional instructions should also be used to improve the code generated for complex
expressions such as the C shortcut evaluation feature. Consider the following C code segment:
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 the following 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
The use of conditional instructions in the above fashion improves performance by minimizing the
number of branches, thereby minimizing the penalties caused by branch mispredictions. This
approach also reduces the utilization of branch prediction resources.
Vue de la page 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 288 289

Commentaires sur ces manuels

Pas de commentaire