82
Use Alternative Code When Multiplying by a Constant
AMD Athlon™ Processor x86 Code Optimization
22007E/0—November 1999
by 11:
LEA
REG2, [REG1*8+REG1]
;3 cycles
ADD
REG1, REG1
ADD
REG1, REG2
by 12:
SHL
REG1, 2
LEA
REG1, [REG1*2+REG1] ;3 cycles
by 13:
LEA
REG2, [REG1*2+REG1]
;3 cycles
SHL
REG1, 4
SUB
REG1, REG2
by 14:
LEA
REG2, [REG1*4+REG1]
;3 cycles
LEA
REG1, [REG1*8+REG1]
ADD
REG1, REG2
by 15:
MOV
REG2, REG1
;2 cycles
SHL
REG1, 4
SUB
REG1, REG2
by 16:
SHL
REG1, 4
;1 cycle
by 17:
MOV
REG2, REG1
;2 cycles
SHL
REG1, 4
ADD
REG1, REG2
by 18:
ADD
REG1, REG1
;3 cycles
LEA
REG1, [REG1*8+REG1]
by 19:
LEA
REG2, [REG1*2+REG1]
;3 cycles
SHL
REG1, 4
ADD
REG1, REG2
by 20:
SHL
REG1, 2
;3 cycles
LEA
REG1, [REG1*4+REG1]
by 21:
LEA
REG2, [REG1*4+REG1]
;3 cycles
SHL
REG1, 4
ADD
REG1, REG2
by 22:
use IMUL
by 23:
LEA
REG2, [REG1*8+REG1]
;3 cycles
SHL
REG1, 5
SUB
REG1, REG2
by 24:
SHL
REG1, 3
;3 cycles
LEA
REG1, [REG1*2+REG1]
by 25:
LEA
REG2, [REG1*8+REG1]
;3 cycles
SHL
REG1, 4
ADD
REG1, REG2
Summary of Contents for Athlon Processor x86
Page 1: ...AMD Athlon Processor x86 Code Optimization Guide TM...
Page 12: ...xii List of Figures AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 16: ...xvi Revision History AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 202: ...186 Page Attribute Table PAT AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 252: ...236 VectorPath Instructions AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 256: ...240 Index AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...