##### 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 mutiplier 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.

##### To set this option in the CrossStudio development environment

To use the hardware multiplier for a project:

- Select the project in the Project Explorer.
- In the Compiler Options group set the Use Hardware Multiplier property to Yes.

It is not possible to set the Use Hardware Multiplier property on a per-file basis.

##### Special notes

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

##### See also

-mmpyinl (Enable inline hardware multiplier)