| |||
| Home > Developing for ARM Processors > About the ARM architectures > Floating-point build options | |||
The following guidelines can be used to help you select the most suitable floating-point build options to use for your application.
There are several options for compiling code that carries out floating-point operations in ARM state code and Thumb state code:
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 compiled for Thumb are compiled to ARM code, because Thumb code cannot contain VFP instructions or access VFP registers. This uses hardware VFP linkage.
When compiling for ARM only, use --fpu=vfp and
not --fpu=softvfp+vfp. Software linkage adds
an overhead in transfer values between VFP and ARM that slows down
the transfers and requires additional instructions.
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.
The Thumb instruction set does not contain VFP instructions
and therefore cannot access VFP registers. Therefore, for Thumb
code, when --fpu=softvfp+vfpv2 is used, the compiler
generates calls to library functions to perform the VFP operations.
These library functions have to use software linkage because the
Thumb code cannot access the VFP registers that are required to
use hardware linkage.
The RVCT libraries include versions of the software floating
point functions that are compiled for ARM, and use VFP instructions
to be used with --fpu=softvfp+vfpv2. These library
functions give improved performance and reduced code size compared
to the full software floating point functions.
The option that provides the best code size or performance
depends on 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.
If you have a mix of ARM and Thumb then you might want to
experiment with the --fpu option to get the best
results.
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.
Choose the options --arm
--fpu vfpv3 to have the compiler generate ARM code only.
This uses hardware VFP linkage.
Choose
the options --thumb --fpu vfpv3 to have the compiler
generate Thumb-2 code only for your entire program. Thumb-2 supports
VFP instructions. Therefore, there is no need to switch to ARM state
to perform VFP operations. This uses hardware VFP linkage.
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.