Datasheet

The C and C++ Libraries
4-90 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
4.12 Selecting real-time division
The division helper 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. A 4-bit quotient requires only 12 cycles, but a 32-bit quotient requires
96 cycles. Some applications require a faster worst-case cycle count at the expense of
lower average performance. For this reason, two divide routines are provided with the
ARM library.
The real-time routine:
always executes in fewer than 45 cycles
is faster than the standard division helper routine for larger quotients
is slower than the standard division helper routine for typical quotients
returns the same results
calls the same error reporting mechanism on a division by zero
does not require any change in the surrounding code.
Select the real-time divide routine, instead of the generally more efficient routine, by
using either:
IMPORT __use_realtime_division
from assembly language
#pragma import(__use_realtime_division)
from C.
Note
Because it uses the CLZ instruction and the DSP multiplies, the real-time division
routine only works on ARM architecture v5TE and above. If you reference
__use_realtime_division
and compile and link for a core that does not support these, the
linker displays an error similar to:
Error: L6218E: Undefined symbol
__realtime_division_only_works_on_architecture_5E__
(referred from myobj.o)