
Align TBYTE Variables on Quadword Aligned Addresses
55
22007E/0—November 1999
AMD Athlon™ Processor x86 Code Optimization
Example (Preferred):
Prolog:
PUSH
EBP
MOV
EBP, ESP
SUB
ESP, SIZE_OF_LOCALS
;size of local variables
AND
ESP, –8
;push registers that need to be preserved
Epilog:
;pop register that needed to be preserved
MOV
ESP, EBP
POP
EBP
RET
With this technique, function arguments can be accessed via
EBP, and local variables can be accessed via ESP. In order to
free EBP for general use, it needs to be saved and restored
between the prolog and the epilog.
Align TBYTE Variables on Quadword Aligned Addresses
Align variables of type TBYTE on quadword aligned addresses.
In order to make an array of TBYTE variables that are aligned,
array elements are 16-bytes apart. In general, TBYTE variables
should be avoided. Use double-precision variables instead.
C Language Structure Component Considerations
Structures (‘struct’ in C language) should be made the size of a
multiple of the largest base type of any of their components. To
me et this require ment, padding should be use d where
necessary.
Language definitions permitting, to minimiz e padding,
structure components should be sorted and allocated such that
the components with a larger base type are allocated ahead of
those with a smaller base type. For example, consider the
following code:
Содержание Athlon Processor x86
Страница 1: ...AMD Athlon Processor x86 Code Optimization Guide TM...
Страница 12: ...xii List of Figures AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 16: ...xvi Revision History AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 60: ...44 Code Padding Using Neutral Code Fillers AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 92: ...76 Push Memory Data Carefully AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 122: ...106 Take Advantage of the FSINCOS Instruction AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 156: ...140 AMD Athlon Processor Microarchitecture AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 176: ...160 Write Combining Operations AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 202: ...186 Page Attribute Table PAT AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 252: ...236 VectorPath Instructions AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Страница 256: ...240 Index AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...