TUESDAY, JULY 21, 2026
avr
AVR: Implement 64-bit fixed-point multiplications in libgcc.
Added 64-bit fixed-point multiplication functions to AVR libgcc.
This patch introduces support for 64-bit fixed-point multiplications to the libgcc library for the AVR microcontroller architecture. It includes both standard and saturating versions of these multiplication functions, along with necessary assembly definitions and a new test case.
In Details
This commit adds support for 64-bit fixed-point multiplication routines to libgcc for the AVR target. It introduces new assembly macros and functions, including _umulditi3_raw, _muluda3, _muluta3, _muludq3, _mulda3, _multa3, _muldq3, _muluQ64_tail, _mulQ64_work, _divsa3, and _udivusa3. The saturating variants are aliased to the standard ones. A new test file fx24-mul.c is also added.
For Context
- AVR
- A family of microcontrollers from Atmel (now Microchip Technology) widely used in embedded systems. GCC supports compilation for various AVR devices.
- libgcc
- The GCC runtime library, providing essential functions like integer division, 64-bit arithmetic, and exception handling that are not directly generated by the compiler's instruction selection.
- fixed-point multiplication
- Multiplication of numbers represented with a fixed number of bits for the fractional part, commonly used in embedded systems where floating-point hardware may be absent or slow.
- saturating arithmetic
- Arithmetic operations where the result is clamped to the maximum or minimum representable value if it exceeds the bounds of the data type, preventing overflow.