Support for BCD was common in early
microprocessors, which were often used in roles like
electronic calculators and
cash registers where the math was all decimal. Examples of such support can be found in the
Intel 8080,
MOS 6502,
Zilog Z80,
Motorola 6800/
6809 and most other designs of the era. In these designs, BCD was directly supported in the ALU, allowing it to perform operations on decimal data directly.
Intel BCD opcodes have remained in the
x86 family to this day, although they are not supported in long mode. These instructions convert one-byte BCD numbers (
packed and unpacked) to binary format before or after arithmetic operations. These operations were not extended to wider formats and hence are now slower than using
32-bit or wider BCD "tricks" to compute in BCD. The
x87 FPU has instructions to convert 10-byte (18 decimal digits) packed decimal data, although it then operates on them as floating-point numbers. The
Motorola 68000 series offered both conversion utilities as well as the ability to directly add and subtract in BCD. These instructions were removed when the
Coldfire instruction set was defined.
The 2008 revision of the IEEE 754 floating-point standard adds three decimal types with two binary encodings, with 7-, 16-, and 34-digit decimal
significands. One of the few
RISC instruction sets to directly support decimal is IBM's
Power ISA, which added support for IEEE 754-2008 decimal floating-point starting with Power ISA 2.05. Decimal integer support had been part of their mainframe line, and as part of the broader effort to merge the
iSeries and
zSeries decimal arithmetic was added to the POWER line so that a single processor could support workloads from these older machines with full performance. The IBM
POWER6 processor is the first Power ISA processor that implemented these types, using the
densely packed decimal binary encoding rather than BCD. Starting with Power ISA 3.0, decimal integer arithmetic instructions were added.
z/Architecture, the 64-bit version of IBM's mainframe instruction set, added support for the same encodings of IEEE 754 decimal floating-point, starting with the
IBM System z9. ==See also==