fafa <[EMAIL PROTECTED]> writes: > >> > I noticed that G++ 4.1.2 (on a Pentium 4) generates different > >> instructions > >> > for > >> > lea 0x0(%esi),%esi > >> > or > >> > lea 0x0(%edi),%edi > >> > with the same meaning but different encoding depending on the switch > >> > "-momit-leaf-frame-pointer". > >> > > >> > >> They are generated by assembler for different alignment adjustments. > > > > To expand on that, note that those instructions do nothing. They are > > nops inserted for alignment purposes. The size of the instruction > > varies depending upon how many bytes it has to take up. > > > > Ian > > > > I see. But why not simple "nop" instructions ? > Is it just for the compactness of the listing, or does it > optimize the instruction prefetching of the CPU ?
It is faster for a typical CPU to execute a single long instruction with no effect than it is for it to execute a series of small instructions with no effect. Ian