Intel® PXA27x Processor Family
Optimization Guide
5-13
High Level Language Optimization
Not aligning data on cache line boundaries has the disadvantage of placing the preload address on
the corresponding misaligned address. Consider this example:
struct {
long ia;
long ib;
long ic;
long id;
} tdata[IMAX];
for (i=0, i<IMAX; i++)
{
PREFETCH(tdata[i+1]);
tdata[i].ia = tdata[i].ib + tdata[i].ic + tdata[i].id];
....
tdata[i].id = 0;
}
In this case if tdata[] is not aligned to a cache line, then the prefetch using the address of
tdata[i+1].ia may not include element id. If the array was aligned on a cache line + 12 bytes, then
the prefetch would have to be placed on &tdata[i+1].id.
If the structure is not sized to a multiple of the cache line size, then the preload address must be
advanced appropriately and requires extra prefetch instructions. Consider this example:
struct {
long ia;
long ib;
long ic;
long id;
long ie;
} tdata[IMAX];
ADDRESS predata = &tdata
for (i=0, i<IMAX; i++)
{
PREFETCH(=16);
tdata[I].ia = tdata[I].ib + tdata[I].ic + tdata[I].id] +
tdata[I].ie;
....
tdata[I].ie = 0;
}
In this case, the preload address was advanced by the size of half a cache line and every other
preload instruction is ignored. Further, an additional register is required to track the next preload
address.
Generally, not aligning and sizing data adds extra computational overhead.
Содержание PXA270
Страница 1: ...Order Number 280004 001 Intel PXA27x Processor Family Optimization Guide April 2004...
Страница 10: ...x Intel PXA27x Processor Family Optimization Guide Contents...
Страница 20: ...1 10 Intel PXA27x Processor Family Optimization Guide Introduction...
Страница 30: ...2 10 Intel PXA27x Processor Family Optimization Guide Microarchitecture Overview...
Страница 48: ...3 18 Intel PXA27x Processor Family Optimization Guide System Level Optimization...
Страница 114: ...5 16 Intel PXA27x Processor Family Optimization Guide High Level Language Optimization...
Страница 122: ...6 8 Intel PXA27x Processor Family Optimization Guide Power Optimization...
Страница 143: ...Intel PXA27x Processor Family Optimization Guide Index 5 Index...
Страница 144: ......