Complex Instructions; Use Of The Lea Instruction - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

IA-32 Intel® Architecture Optimization

Complex Instructions

Assembly/Compiler Coding Rule 40. (ML impact, M generality) Avoid
using complex instructions (for example,
more than four µops and require multiple cycles to decode. Use sequences of
simple instructions instead.
Complex instructions may save architectural registers, but incur a
penalty of 4 µops to set up parameters for the microcode ROM.

Use of the lea Instruction

In many cases, the
shift
instruction can also be used as a multiple operand addition instruction,
for example:
lea ecx, [eax + ebx + 4 + a]
Using
lea
for operands of arithmetic instructions. This use may also save code
space.
If the
lea
of the sequence of µops is shorter if
the
lea
µops. This, however, this increases the total number of µops, leading to
a trade-off.
Assembly/Compiler Coding Rule 41. (ML impact, M generality) If a
instruction using the scaled index is on the critical path, a sequence with
may be better. If code density and bandwidth out of the trace cache are the
critical factor, then use the
2-74
instruction or a sequence of
lea
instructions can replace constant multiply instructions. The
in this way may avoid register usage by not tying up registers
instruction uses a shift by a constant amount then the latency
instruction may be replaced with an appropriate sequence of
enter
s are used instead of a shift, and
add
instruction.
lea
,
, or
) that have
leave
loop
,
,
lea
add
and
sub
lea
lea
s
add

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ARCHITECTURE IA-32 and is the answer not in the manual?

Questions and answers

Table of Contents