Minor tweaks improve double-precision float conversions for AVR.
GCC's AVR backend now has slightly adjusted implementations for 64-bit unsigned and signed integer to double-precision float conversions.
This commit makes minor adjustments to __floatdidf and __floatundidf in the AVR backend, which are functions responsible for converting 64-bit signed and unsigned integers to double-precision floating-point numbers. While the immediate impact is small, these tweaks could lead to subtle improvements in accuracy or efficiency for AVR applications that perform extensive floating-point arithmetic. Developers may see minimal changes in code generation or numerical results when targeting AVR with GCC.
In Details
The AVR target's libf7 library provides software implementations for floating-point operations. The __floatdidf and __floatundidf functions handle conversions from 64-bit integers (long long equivalents) to double. This change in libf7.c likely refines the arithmetic steps or precision handling within these software-emulated floating-point routines, targeting the specific constraints and instruction set of the AVR architecture.
For Context
When a computer program needs to convert between different types of numbers, like whole numbers (integers) and numbers with decimal points (floating-point numbers), it uses special conversion routines. For microcontrollers like the AVR, which often lack dedicated hardware for advanced floating-point math, these conversions are handled by software libraries. This update modifies two such routines in GCC's library for AVR, specifically those that convert very large whole numbers (64-bit integers) into high-precision decimal numbers (double-precision floats). These changes aim to make these software-based conversions more accurate or efficient for AVR programs.