Optimizing C Libraries; A.6 Optimizing C Libraries; Optimizations For Size; Space/Performance Trade Off - Intel XScale Core Developer's Manual

Table of Contents

Advertisement

Intel XScale® Core Developer's Manual
Optimization Guide
A.6

Optimizing C Libraries

Many of the standard C library routines can benefit greatly by being optimized for the core
architecture. The following string and memory manipulation routines should be tuned to obtain the
best performance from the core architecture (instruction selection, cache usage and data prefetch):
strcat, strchr, strcmp, strcoll, strcpy, strcspn, strlen, strncat, strncmp, strpbrk, strrchr, strspn,
strstr, strtok, strxfrm, memchr, memcmp, memcpy, memmove, memset
A.7

Optimizations for Size

For applications such as cell phone software it is necessary to optimize the code for improved
performance while minimizing code size. Optimizing for smaller code size will, in general, lower
the performance of your application. This chapter contains techniques for optimizing for code size
using the core instruction set.
A.7.1

Space/Performance Trade Off

Many optimizations mentioned in the previous chapters improve the performance of ARM code.
However, using these instructions will result in increased code size. Use the following
optimizations to reduce the space requirements of the application code.
A.7.1.1.

Multiple Word Load and Store

The LDM/STM instructions are one word long and let you load or store multiple registers at once.
Use the LDM/STM instructions instead of a sequence of loads/stores to consecutive addresses in
memory whenever possible.
A.7.1.2.

Use of Conditional Instructions

Using conditional instructions to expand if-then-else statements as described in
"Conditional Instructions"
use conditional instructions if application code space requirements are an issue.
A.7.1.3.

Use of PLD Instructions

The preload instruction PLD is only a hint, it does not change the architectural state of the
processor. Using or not using them will not change the behavior of your code, therefore, you should
avoid using these instructions when optimizing for space.
218
will result in increasing the size of the generated code. Therefore, do not
January, 2004
Section A.3.1,
Developer's Manual

Advertisement

Table of Contents
loading

Table of Contents