GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
avr

AVR: Add [un]signed saturated accumulator divisions.

AVR libgcc now supports signed and unsigned saturated accumulator divisions for USAmode.

This commit adds support for signed and unsigned saturated accumulator divisions in the USAmode for the AVR target. The existing non-saturating division functions have been reworked to become aliases of the new saturating versions, resulting in a slight code size change for some functions. New test cases are included.

In Details

The AVR target now supports ss_div, us_div, div, and udiv code attributes in avr.md. A new alldiv code iterator in avr-fixed.md is used for all [U]SAmode division expanders and instructions, supporting saturated results. Non-saturating functions are now aliases to their saturating counterparts, with a minor impact on code size for __divsa3.

For Context
AVR
A family of microcontrollers from Atmel (now Microchip Technology). GCC has specific backends for targeting these devices.
libgcc
The GCC helper library, providing essential functions not directly supported by the target architecture or handled by the compiler, such as integer division, exception handling, and floating-point operations.
[U]SAmode
AVR-specific machine modes representing unsigned saturated accumulators, used for fixed-point arithmetic.
Saturation arithmetic
An arithmetic mode where results that exceed the maximum representable value are clamped to the maximum, and results that go below the minimum are clamped to the minimum, rather than wrapping around.
Filed Under: avrfixed-pointlibgccsaturation