The PDP-11 has seven dyadic instructions (I'm not counting the byte/word varieties separately), which take a full six bits for each of its operands. That's twelve bits to specify the operands, and four bits to specify the opcode.
These instructions are,
- add
- sub
- bit (computes a & b, discards the result and updates the flags only)
- bis (this should have been called or, since that's what it is)
- bic (computes a &= !b)
- cmp
- mov
The opcode space is quite crowded because the bitfield to specify the opcode is very narrow (only three bits!) and because two values for this bitfield are reserved (000 means the instruction is not dyadic, 111 is apparently reserved for later expansion).
I'm quite surprised by the lack of basics here. Beside byte-sized add and subtraction, I would expect at least an and
, and an exclusive or. Maybe an add-with-carry instruction. It seems like a step back from the PDP-6 of six years earlier. I appreciate what I'm asking for can be synthesized from what's there, but that's at quite a cost, because of the Extremely Spacious way of specifying operands. For this reason I expect code density for PDP-11 programs to be quite low.
Around nine years after the first PDP-11, the apparently PDP-11 inspired 68000 from Motorola has the and
and eor
, but not bic
or bit
as far as I can see (the btst
and bclr
might make reasonable substitutes in some circumstances).
On the other hand, the PDP-11 seems to come out well in this paper concerning code density of various architectures. But that paper appears to consider the /40, which has at least an xor
instruction from the wishlist up there.
Recap:
The PDP-11 needs a full six bits per operand, which is almost a byte. This puts pressure on the opcode space, meaning it can't possibly offer all the same instructions as, say, the PDP-6 did. But what they left out seems like the best instructions. This leaves the PDP-11 with a weird set of boolean instructions, quite unlike the repertoire offered by competitors/successors/predecessors. You'd expect this to mean that common operations need to be synthesized from what the PDP-11 offers. Yet, the PDP-11 compares favorably on code-density comparisons.
What am I missing?
bis
does that), clear bits (bic
does that), and test whether bits are set (bit
does that). Toggling bits is also helpful. Generalized bitwiseand
,or
, andxor
are theoretically useful, but in my experience 90+% of their use is for manipulating bits for the purpose I just described.