Re: Rational behind removing register forms of inc, dec?



On Oct 23, 4:22 pm, "Rod Pemberton" <do_not_h...@xxxxxxxxxxxxx> wrote:
"Charles Crayne" <ccra...@xxxxxxxxxx> wrote in message

news:20071023133450.2ae6de9c@xxxxxxxxxxxxxxxxxx



Long mode is 64-bit mode, but, fortunately, the r/m inc/dec instructions
have not gone away -- just the register only forms. Unless you code at
the machine code level, you won't even notice the difference.

Anyone know what the rational behind removing the register forms of inc, dec
is?

I'd think that if one was forced to remove instruction modes from
instructions, one would start with the memory modes since a mov or lea could
be used to replicate the removed mode. I'd also think that since hand coded
x86 code can be heavily register based, sometimes avoiding memory forms of
instructions completely (using mov or lea exclusively), that one would
choose to preserve register based instructions. The two opcode frequency
documents I have indicate that inc (but not dec) is also a high usage
instruction comparable to push. It's listed in the top five used
instructions. Was it really that hard to find a few bytes when they
elimated most of the obsolete instructions from the single byte instruction
table?


The instructions are still there, just not the one byte forms (there
are multi byte forms that are identical in operation). Pure and
simple, they needed a block of consecutive opcodes to implement the
REX prefix byte(s). My personal opinion is that the great effort to
not change the majority of instruction encodings in long mode was a
serious mistake, and a big opportunity to clean that mess up was
missed.

And yes, even with the obsolete instructions they eliminated, the
opcode space is still pretty dense.

.



Relevant Pages

  • Re: Optimization Questions
    ... cycles you'd save would be more than offset by the cycles you'd burn ... instructions go through port 0 and port 1. ... a 16-bit register, writing one afterwards will be fast. ... Pre-read the value in EAX ...
    (comp.lang.asm.x86)
  • Re: Learning ARM assembler...
    ... the newer ARM instructions, you can largely ignore them if you prefer. ... programmers also develop habits that help to avoid non-orthogonality (for ... that you can't use another register for the same purpose). ... instructions have a more compact encoding when used in this way, ...
    (comp.sys.acorn.programmer)
  • Re: Learning ARM assembler...
    ... the sum of a displacement plus a register plus a second register shifted ... instruction encoding standpoint. ... instructions have a more compact encoding when used in this way, ...
    (comp.sys.acorn.programmer)
  • Re: Kind of new: function implementation questions, MASM
    ... >sub esp, varsize ... >select which of the local variables to copy into the working register, ... If you have 512kB of 8-way associative cache, ... You probably shouldn't use the prefetch instructions at all. ...
    (comp.lang.asm.x86)
  • Re: The coming death of all RISC chips.
    ... anton@xxxxxxxxxxxxxxxxxxxxxxxxxx wrote: ... the number of write ports in the register file. ... (with instructions only accessing one accumulator ...
    (comp.arch)