Syntax

-mmpy

Description

This option instructs the compiler to generate code that can use the MSP430 hardware multiplier. By default, the hardware multiplier is not used and all integer and floating-point multiplications are carried out by software loops.

When using the hardware multiplier, the compiler ensures that no interrupts occur during the time the multiplier is in use. Global interrupts are disabled during a multiplication to prevent, for instance, an interrupt being taken immediately after the multiplication is complete but before the result has been loaded which could possibly corrupt the result of the multiplication. Because interrupts are disabled during hardware-assisted multiplication, interrupt latency is increased—if you wish to have the lowest possible interrupt latency, then do not enable the hardware multiplier and use soft multiplication instead.

The CrossWorks compiler generates inline code to use the hardware multiplier for 16-bit multiplications and calls out-of-line subroutines for all other multiplications. The runtime library also uses the hardware multiplier to accelerate multiplication of floating-point values.

Project property

Compiler Options > Use Hardware Multiplier

It is not possible to set this option on a per-file basis.

Note

There is no means to prevent a non-maskable interrupt from occurring, so you must be very careful not to use the hardware multiplier in an NMI interrupt service routine.