Intel Computer Hardware 80200 Manual do Utilizador Página 240

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 289
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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.
Vista de página 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 288 289

Comentários a estes Manuais

Sem comentários