3.5. Fixed-Point Arithmetic

Sourcery CodeBench for ARM EABI includes experimental support for fixed-point arithmetic using a set of new data types, as described in the draft ISO/IEC technical report TR 18037. This support is provided for all ARM targets, and uses specialized instructions where available, e.g. saturating add and subtract operations on ARMv6T2 and above. Library functions are used for operations which are not natively supported on the target architecture.

This feature is a GNU extension, so is only available when the selected language standard includes GNU extensions (e.g. -std=gnu90, which is the default). Furthermore, only C is supported, not C++.

TR 18037 leaves up to the implementation the sizes of various quantities within the new data types it defines. For Sourcery CodeBench for ARM EABI, these are, briefly:

These values (and various other useful constants) are also defined in the header file stdfix.h for use in your programs. Note that there is currently no support for the new standard-library functions described in TR 18037, nor for the pragmas controlling precision of operations.

Fixed-point extensions are not currently supported by GDB, nor are they compliant with the ARM EABI (which does not specify anything about fixed-point types at present). Code using fixed-point types cannot be expected to interact properly (across ABI boundaries) with code generated by other compilers for the ARM architecture.