| |||
| Home > Key Features of ARM Architecture Versions > ARM and Thumb floating-point build options (ARMv6 and earlier) | |||
There are several options for compiling code that carries out floating-point operations in ARM code and Thumb 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. This is because the Thumb instruction
set, in ARMv6 and earlier, does not contain VFP instructions and
therefore cannot access VFP registers. This uses hardware VFP linkage, which
means floating-point arguments are passed in floating-point registers.
When compiling for ARM only, use --fpu=vfpv2 and
not --fpu=softvfp+vfpv2. 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, in ARMv6 and earlier, does not
contain VFP instructions and therefore cannot access VFP registers.
When you compile for Thumb, setting --fpu=softvfp+vfpv2 enables
the use of ARM Compiler libraries that enable access to the VFP
registers using software linkage.
The libraries include software floating point functions that are compiled for ARM and use VFP instructions. 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, 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.
Assembler Reference:
Technical Reference Manual for your processor.