A zero register is a
processor register
A processor register is a quickly accessible location available to a computer's processor. Registers usually consist of a small amount of fast storage, although some registers have specific hardware functions, and may be read-only or write-onl ...
that always returns the value zero and has no effect when it is written to. It is found in
instruction set architecture
In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, ...
s including the
CDC 6600
The CDC 6600 was the flagship of the 6000 series of mainframe computer systems manufactured by Control Data Corporation. Generally considered to be the first successful supercomputer, it outperformed the industry's prior recordholder, the I ...
,
System/360
The IBM System/360 (S/360) is a family of mainframe computer systems announced by IBM on April 7, 1964, and delivered between 1965 and 1978. System/360 was the first family of computers designed to cover both commercial and scientific applicati ...
and
ARM64
AArch64, also known as ARM64, is a 64-bit version of the ARM architecture family, a widely used set of computer processor designs. It was introduced in 2011 with the ARMv8 architecture and later became part of the ARMv9 series. AArch64 allows ...
, among others.
Zero appears as a constant in many instructions, notably "branch if zero", and optimizing these instructions can have a positive benefit on performance. Some architectures accomplish this with dedicated
opcode
In computing, an opcode (abbreviated from operation code) is an enumerated value that specifies the operation to be performed. Opcodes are employed in hardware devices such as arithmetic logic units (ALUs), central processing units (CPUs), and ...
s, specialized variations of their basic instructions. Implementing these requires additional logic in the
instruction decoder
A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary processor in a given computer. Its electronic circuitry executes instructions of a computer program, such as arithmetic, log ...
. The zero register can accomplish the same effect without requiring new opcodes, although at the cost of dedicating a register to this feature, which may have negative impact for architectures with limited number of registers.
The
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
architecture has no zero register, while
ARM added a zero register for ARM64. The
RISC-V
RISC-V (pronounced "risk-five") is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles. The project commenced in 2010 at the University of California, Berkeley. It transfer ...
architecture includes one with the register name "x0" and the ABI name "zero"; the reason for this inclusion is stated as "Dedicating a register to zero is surprisingly a large factor in simplifying the RISC-V ISA.
note: this is different to zeroing a register such as by xor as it uses physical hardware.
"
References
*
*
Digital registers
{{hardware-stub