15

Binary Coded Decimal Instructions are part of the x86 architecture at least from the i8086. They are like AAA, DAA, AAS, DAS, and help to work with arithmetic operations on BCD numbers.

Here is some reference of them:

https://en.wikipedia.org/wiki/Intel_BCD_opcode

According to Intel's Software Developer's Manual. Those instructions are not available in long (64 bits) mode. I'm know maybe the only people that actually know why are the designers of the architecture, but why do you think they remove them?

felknight
  • 1,383
  • 1
  • 9
  • 25

1 Answers1

6

The answer is in your link:

Adding BCD numbers using these opcodes is a complex task, and requires many instructions to add even modest numbers. It can also require a large amount of memory.

All integer calculations are exact, so the radix of the number representation is not important for accuracy. Therefore, even financial software today usually stores values in binary representation and only converts to decimal for input and output.

On an x86 processor calculations with binary numbers are usually a lot faster than the same calculations with BCD numbers.

as to why the opcodes are removed from x86_64 even though the capability is still present in the hardware (though likely implemented in microcode) per Raymond Chen's comment:

They free up valuable 1-byte opcodes for future use.

gordy
  • 9,360
  • 1
  • 31
  • 43
  • So they simple removed it because is was not useful anymore? – felknight Oct 17 '15 at 03:49
  • 1
    @Felipe No one uses them, and they take up silicon space and add complexity to the processor. – Mysticial Oct 17 '15 at 03:52
  • What still bothers me is, they are available on in 16 and 32 bits mode. They are still on the silicon, why to remove the from 64 bits mode? – felknight Oct 17 '15 at 03:56
  • Once we stopped thinking only in decimal and could wrap our heads around binary, etc, we didnt need these instructions. Basically about the second or third day of asm programming, no use for them... – old_timer Oct 17 '15 at 04:31
  • 19
    @Felipe They free up valuable 1-byte opcodes for future use. – Raymond Chen Oct 17 '15 at 04:37
  • 2
    It's not true that "Once we stopped thinking only in decimal and could wrap our heads around binary, etc, we didnt need these instructions". If only there were BCD instructions that operated on longer words they'd be really useful in financial software. The real reason that they're not used is because they only operate on words that the 8 bit 8080 CPU could operate on - the instructions only exist so that Intel could say 45 years ago "look ma, we can run CP/M software with just a simple re-assemble!" – DrHyde Aug 12 '21 at 20:00