13.07.2015 Views

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GENERAL OPTIMIZATION GUIDELINESExample 3-12. Macro-fusion, If StatementWithout Macro-fusionC code int 1 a = 7;if ( a < 77 )a++;elsea--;Disassembly int a = 7;mov dword ptr [ a ], 7if (a < 77)cmp dword ptr [ a ], 4DH 3jge Deca++;mov eax, dword ptr [ a ]add eax, 1mov dword ptr [a], eaxelsejmp Enda--;Dec:mov eax, dword ptr [ a ]sub eax, 1mov dword ptr [ a ], eaxEnd::With Macro-fusionunsigned int 2 a = 7;if ( a < 77 )a++;elsea--;unsigned int a = 7;mov dword ptr [ a ], 7if ( a < 77 )mov eax, dword ptr [ a ]cmp eax, 4DHjae Deca++;add eax,1mov dword ptr [ a ], eaxelsejmpEnda--;Dec:sub eax, 1mov dword ptr [ a ], eaxEnd::NOTES:1. Signed iteration count inhibits macro-fusion2. Unsigned iteration count is compatible with macro-fusion3. CMP MEM-IMM, JGE inhibit macro-fusion3-20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!