Architecture – Are there memory-memory instructions

Architecture

From Tanenbaum's Structured Computer Organization,

Most instructions can be divided into one of two categories: register-memory or register-register.

Register-memory instructions allow memory words to be fetched into registers, where, for example, they can be used as ALU inputs
in subsequent instructions. (‘‘Words’’ are the units of data moved
between memory and registers. A word might be an integer. We will
discuss memory organization later in this chapter.) Other
register-memory instructions allow registers to be stored back into
memory.

A typical register-register instruction fetches two operands from the registers, brings them to the ALU input registers, performs
some operation on them (such as addition or Boolean AND), and stores
the result back in one of the registers. The process of running two
operands through the ALU and storing the result is called the data
path cycle
and is the heart of most CPUs. To a considerable extent,
it defines what the machine can do. Modern computers have multiple
ALUs operating in parallel and specialized for different functions.
The faster the data path cycle is, the faster the machine runs.

Are there memory-memory instructions?

Or is a memory-memory "operation" implemented as two register-memory instructions (one for read and the other for write)?
Isn't this inefficient than moving data directly between two places in the same memory without going via a register?

Best Answer

Lots of machine architectures have memory-memory instructions.

The IBM System/360 and its successors have a whole set of instructions that operate on two locations in memory (the Storage Storage (SS) group). "Move Character" (MVC) instruction copies up to 256 bytes from one memory location to another, and even has a clear definition for when the source and destination ranges overlap. Similarly there are Compare Logical Character (CLC) (which does a string-comparison), OR Character (OC), AND Character (NC), and XOR Character (XC), which are bitwise logical operators, etc. The also have a set of decimal arithmetic instructions, which only operate on memory - there aren't any registers for decimal math.

Then there are the memory-immediate instructions, which have one operand in memory and the other in the instruction itself. The DEC PDP-10 had Add One to Storage (AOS) and Subtract One from Storage (SOS). The IBM S/360 family had a wide range of Storage Immediate (SI) instructions, in which one operand was a memory location and the other was an 8-bit quantity in the instruction.