4.5.2 Division, Shift and Modulo Operations
Some AVR EC family of devices implement a 32-bit Divide Accelerator (DIVA) module, which can perform 32-bit signed or unsigned integer hardware divisions and 32-bit shifts and rotates in hardware. The compiler can employ routines which set up, initiate, and obtain results from this module rather than call library routines that perform the same operation.
When building for devices that implement this module, its operation is automatically enabled, so that division, shift and modulo operations will invoke the DIVA routines. The -mdiva
driver option makes this action explicit.
The -mno-diva
option can be used to disable this operation, having these operations instead performed by conventional library routines that will be larger and slower than the DIVA routines. There is also a __nodiva
function attribute, so that this functionality can be controlled on a per function basis.
The preprocessor macro __AVR_HAVE_DIVA__
will be set if the device being targeted has this module and it is enabled.
Some floating-point operations also employ integer operations that might also be performed by the DIVA module when possible.