Real-time integer division in the Arm® libraries
The Arm® library provides a real-time division routine and a standard division routine.
The standard division routine supplied with the Arm libraries provides good overall performance. However, the amount of time required to perform a division depends on the input values. For example, a division that generates a four-bit quotient might require only 12 cycles while a 32-bit quotient might require 96 cycles. Depending on your target, some applications require a faster worst-case cycle count at the expense of lower average performance. For this reason, the Arm library provides two divide routines.
The real-time routine:
- Always executes in fewer than 45 cycles.
- Is faster than the standard division routine for larger quotients.
- Is slower than the standard division routine for typical quotients.
- Returns the same results.
- Does not require any change in the surrounding code.
NoteReal-time division is not available in the libraries for the Armv6‑M and Armv8‑M.baseline architecture.
NoteThe Armv7‑M, Armv7‑R, and Armv8‑M.mainline architectures support hardware floating-point divide. Code running on these architectures do not require the library divide routines.
Select the real-time divide routine using either of the following methods:
IMPORT __use_realtime_divisionfrom assembly language.
__asm(".global __use_realtime_division\n\t")from C.