4.6.6. Using the --fpu option

The following guidelines can be used to help you select the most suitable floating-point build options to use for your application.

ARM and Thumb floating-point (ARMv6 and earlier)

There are several choices for compiling code that carries out floating-point operations in ARM state code and Thumb state code:

ARM only

Choose the option --fpu vfpv2 to have the compiler generate ARM code only for functions containing floating-point operations.

When the option --fpu vfpv2 is selected, the compiler generates ARM code for any function containing floating-point operations, regardless of whether the compiler is compiling for ARM or compiling for Thumb.

Functions containing floating-point operations and that are complied for Thumb are compiled to ARM code, because Thumb code cannot contain VFP instructions or access VFP registers.

Mixed ARM/Thumb

Choose the option --fpu softvfp+vfpv2 to have the compiler generate mixed ARM/Thumb code.

When the option --fpu softvfp+vfpv2 is selected, all functions are compiled using software floating-point linkage. This means that:

  • floating-point arguments are passed to and returned from functions in integer registers

  • library functions containing ARM code are called to carry out floating-point operations from Thumb code.

Thumb code cannot contain VFP instructions or access VFP registers. Software floating-point linkage enables functions containing floating-point operations and that are compiled for Thumb to be compiled to Thumb code. However, library functions are called to carry out the floating-point operations in ARM code.

The option that provides the best code size or performance depends upon the code being compiled. When compiling for ARM, it is best to experiment with the options --fpu softvfp+vfpv2 and --fpu vfpv2 to determine which provides the required code size and performance attributes.

ARM and Thumb-2 floating-point (ARMv7, RVDS 3.0 and later)

Mixed ARM/Thumb-2

Choose the option --fpu softvfp+vfpv3 to have the compiler generate mixed ARM/Thumb code.

When the option --fpu softvfp+vfpv3 is selected, all functions are compiled using software floating-point linkage. This means that floating-point arguments are passed to and returned from functions in ARM integer registers.

Software floating-point linkage enables you to link with generic libraries and legacy code that are themselves built with software floating-point linkage.

ARM only

Choose the options --arm --fpu vfpv3 to have the compiler generate ARM code only.

Thumb-2 only

Choose the options --thumb --fpu vfpv3 to have the compiler generate Thumb-2 code only for your entire program, without needing to switch to ARM state to perform VFP operations.

Note

This option is available only for ARMv7 processors with VFPv3, for example the Cortex-A8, where VFP is directly accessible from both the ARM and Thumb-2 instruction set.

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H
Non-Confidential