Extremely CISC instructions

Peter Corlett abuse at cabal.org.uk
Tue Aug 24 10:57:14 CDT 2021


On Tue, Aug 24, 2021 at 08:47:33AM -0500, John Foust via cctalk wrote:
> At 04:13 AM 8/24/2021, Peter Corlett via cctalk wrote:
>> move.b ([0x12345678, %pc, %d0.w*8], 0x9abcdef0), ([0x87654321, %sp], %a0*4, 0x0fedcba9)
> And which language and compiler case was this aimed at?  

I have no idea and dread to think, although I chose a worst-case example
which doesn't actually make much sense.

Those scary-looking double-indirections in the instructions are just the
result of a generalised EA calculation mode which combines an inner offset
(which may be 0), base register, optional shifted index register, optional
indirection (before or after indexing), and an outer offset (which may also
be 0), to which the MOVE instruction itself adds indirection.

Combining a few of these is normal even on RISC machines: PC-plus-offset and
SP-plus-offset are used to get constants and stack-based variables. Adding a
shifted index is useful for array lookups. If it's an array of pointers,
indirection makes sense. And finally, if it's a pointer to a structure and
we want something other than the first field, a constant needs adding. So
it's easy to see how one can occasionally end up using this addressing mode
and enabling much of its functionality.

I suspect this addressing mode is used much more often with
address-calculating instructions such as LEA than those which operate
directly on the address like MOVE. If the 68000 didn't have a split register
file, this could also be (mis)used like it is on x86 to do cheap arithmetic
and multiplication by 3, 5, and 9.

> Wasn't that a primary driver for complex CISC instructions? That if it
> happened often enough, it would be faster or smaller as a single
> instruction?

You can get a lot of simpler m68k instructions in 22 bytes :)

>> (Yet Amiga owners used to poke fun at PC owners with their excessively
>> complex x86, which has simpler addressing modes.)
> I dunno, 68000 seemed like PDP-11 to me, and I often say one of the big
> reasons I quit a particular job was the prospect of my role changing to
> having to write 80x86 assembler all day.

I encountered the 68000 first, and when I eventually saw the PDP-11
instruction coding a few decades later, the lineage seemed obvious.



More information about the cctech mailing list