0
votes

A friend and I were talking about embedded processors and the like last night and we got on the topic of ASM and specific instruction sets - although I assume this question can be applied to x86 processors as well.

While learning about the registers in ASM, it was made apparent that all registers had a 100% unique and specific use (at least in the x86 architecture). However, when discussing some of his processors he informed me some of the chips he was using had several general purpose registers that could be used for anything and very few, if any, registers that were used by instructions specifically.

When it boils down to it, can't any register technically be used to carry out instructions? They're all the same size, what difference would it make (Stack pointer, etc. aside)?

2
And as a disclaimer, just want to throw out there that I'm not looking to write hack-ish or ill-formed code. Just an innocent question. - Qix - MONICA WAS MISTREATED
I would guess this is better answered by someone with digital design knowledge. It is possible that having a dedicated path to a single register is slightly more efficient than having a choice of registers, but I honestly don't know. You have to also remember that todays x86 instruction set is an evolution from the earliest microprocessors. - President James K. Polk

2 Answers

3
votes

An instruction set where any register can be used as an operand for an instruction is called orthogonal. The 8086 was most definitely not an orthogonal design. A competitor, released several years after 8086 was the Motorola 68000, a highly orthogonal design and favored by many programmers for its qualities.

The 8086 design was however not picked at random, two very important principles played a role:

  • Compatibility with the previous generation, 8080, was a strong goal. Permitting mechanical translation of old assembly code to the new processor. The 8080 was in turn heavily affected by the 8008. Getting a new architecture accepted in the market place is always difficult, Intel recognized early that the investment in tools and programs were an important asset for their customers. A goal that has served it well for a very long time and surely the reason the design has lasted as long as it has.

  • Process technology sets a firm upper limit on how many transistors you can use to implement a processor. The 8086 required only 29,000 active transistors, quite an engineering feat for a 16-bit processor. Using a non-orthogonal design permits dropping a lot of glue logic, it is also faster. The 68000 chose a different use for its budget, orthogonal instruction set but a pretty crappy bus interface, begetting the infamous bus error processor fault when data is addressed on a non-aligned address for example.

1
votes

it was made apparent that all registers had a 100% unique and specific use

False. What's the one and only use of EAX ?

can't any register technically be used to carry out instructions

You can use any registers the way you like. You just have to be aware that some instructions expect operands / return results in specific registers. For example loop decrements ECX until it becomes 0, movsb moves from ESI to EDI etc.