On Tue, Aug 24, 2021 at 01:38:33AM +0100, Tom Stepleton via cctalk wrote:
For the sake of illustration to folks who are not
necessarily used to
thinking about what computers do at the machine code level, I'm interested
in collecting examples of single instructions for any CPU architecture
that are unusually prolific in one way or another. [...]
The one that immediately comes to mind is the kitchen-sink MOVE in the 68020
which comes in at 22 bytes: 2 for the instruction itself, then two full-size
"full extension words" (one each for the source and destination) which
themselves are 2 for the flags, and 4 each for the base and outer
displacement.
So that'd be something like:
move.b ([0x12345678, %pc, %d0.w*8], 0x9abcdef0), ([0x87654321, %sp], %a0*4, 0x0fedcba9)
Which does something like this:
* Compute 0x12345678 + %pc + %d0.w * 8
* Fetch 4 bytes from that address and add 0x9abcdef0 to that.
* Fetch a byte from that address.
* Compute 0x87654321 + %sp
* Fetch 4 bytes from that address and add %a0*4 + 0x0fedcba9 to that.
* Store the previously-fetched byte to that address.
(Yet Amiga owners used to poke fun at PC owners with their excessively
complex x86, which has simpler addressing modes.)
Unsurprisingly, when NXP tried to make m68k a bit more RISCy so it could go
faster and compete with ARM in the embedded sphere, one of the things which
were tossed out were these mad addressing modes, along with any other
encoding which took more than 6 bytes.