Skip to main content

Module decimal

Module decimal 

Source
Expand description

The decimal floating types, as the calls to libgcc’s routines for them.

_Decimal32, _Decimal64 and _Decimal128 are carried in the binary integer decimal encoding, which is what gcc uses on x86-64 and what the __bid_ routines in libgcc compute with. No instruction on this machine does arithmetic on that encoding, so every operation on one is a call. Moving, loading, storing and passing one is not, because the convention puts a decimal in the same vector register a binary float of its width goes in, and the rule set is written by width for exactly those. So this pass is the whole of the difference, the same way crate::quad is for _Float128.

Every name here is built rather than looked up in crate::capability, because the family is regular: the operation, then sd, dd or td for the decimal width, then the other format’s letters where there is one, then the operand count for arithmetic and comparisons. The one part that is not a pattern is which conversions libgcc calls extend and which trunc, and across spells that out.

What is not done here is left to the steps after it. A negation or a constant at thirty two or sixty four bits is the sign bit and the bits, which crate::expand::floats already does by width without caring what the bits mean. A constant at a hundred and twenty eight bits goes through the frame in crate::quad for the same reason a _Float128 one does. A conversion between a decimal and a __bf16 has no routine and is left for the selector to refuse by name.

Functions§

calls
Rewrites every operation on a decimal float into the call that performs it.