Software Optimization Guide for AMD64 Processors

25112 Rev. 3.06 September 2005

 

add reg1, reg2

 

by 22:

imul reg1, 22

; Use the IMUL instruction.

by 23:

lea reg2, [reg1+reg1*8]

; 3 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 24:

lea reg1, [reg1+reg1*2]

; 3 cycles

 

shl reg1, 3

 

by 25:

lea reg2, [reg1+reg1*8]

; 3 cycles

 

shl reg1, 4

 

 

add reg1, reg2

 

by 26:

imul reg1, 26

; Use the IMUL instruction.

by 27:

lea reg2, [reg1+reg1*4]

; 3 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 28:

lea reg2, [REG1*4]

; 3 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 29:

lea reg2, [reg1+reg1*2]

; 3 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 30:

lea reg2, [reg1+reg1]

; 3 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 31:

mov reg2, reg1

; 2 cycles

 

shl reg1, 5

 

 

sub reg1, reg2

 

by 32:

shl reg1, 5

; 1 cycle

166

Integer Optimizations

Chapter 8

Page 182
Image 182
AMD 250 manual 166