5.51 Compiler options for floating-point linkage and computations

Compiler options determine the type of floating-point linkage and floating-point computations.

By specifying the type of floating-point linkage and floating-point computations you require, you can determine, from the following table, the associated compiler command-line options that are available.

Table 5-13 Compiler options for floating-point linkage and floating-point computations

Linkage Computations    
Hardware FP linkage Software FP linkage Hardware FP coprocessor Software FP library (fplib) Compiler options
No Yes No Yes

--fpu=softvfp

--apcs=/softfp

No Yes Yes No

--fpu=softvfp+vfpv2

--fpu=softvfp+vfpv3

--fpu=softvfp+vfpv3_fp16

--fpu=softvfp+vfpv3_d16

--fpu=softvfp+vfp3_d16_fp16

--fpu=softvfp+vfpv4

--fpu=softvfp+vfpv4_d16

--fpu=softvfp+fpv4-sp

--apcs=/softfp

Yes No Yes No

--fpu=vfp

--fpu=vfpv2

--fpu=vfpv3

--fpu=vfpv3_fp16

--fpu=vfpv3_dp16

--fpu=vfpv3_d16_fp16

--fpu=vpfv4

--fpu=vfpv4_d16

--fpu=fpv4-sp

--apcs=/hardfp

softvfp specifies software floating-point linkage. When software floating-point linkage is used, either:

  • The calling function and the called function must be compiled using one of the options --softvfp, --fpu softvfp+vfpv2, --fpu softvfp+vfpv3, --fpu softvfp+vfpv3_fp16, softvfp+vfpv3_d16, softvfp+vfpv3_d16_fp16, softvfp+vfpv4, softvfp+vfpv4_d16, or softvfp+fpv4-sp.

  • The calling function and the called function must be declared using the __softfp keyword.

Each of the options --fpu softvfp, --fpu softvfp+vfpv2,--fpu softvfp+vfpv3, --fpu softvfp+vfpv3_fp16, --fpu softvfpv3_d16, --fpu softvfpv3_d16_fp16, --fpu softvfp+vfpv4, softvfp+vfpv4_d16 and softvfp+fpv4-sp specify software floating-point linkage across the whole file. In contrast, the __softfp keyword enables software floating-point linkage to be specified on a function by function basis.

Note

Rather than having separate compiler options to select the type of floating-point linkage you require and the type of floating-point computations you require, you use one compiler option, --fpu, to select both. For example, --fpu=softvfp+vfpv2 selects software floating-point linkage, and a hardware coprocessor for the computations. Whenever you use softvfp, you are specifying software floating-point linkage.

If you use the --fpu option, you must know the VFP architecture version implemented in the target processor. An alternative to --fpu=softvfp+... is --apcs=/softfp. This gives software linkage with whatever VFP architecture version is implied by --cpu. --apcs=/softfp and --apcs=/hardfp are alternative ways of requesting the integer or floating-point variant of the Procedure Call Standard for the ARM Architecture (AAPCS).

To use hardware floating-point linkage when targeting ARM Linux, you must explicitly specify a --fpu option that implies hardware floating-point linkage, for example, --fpu=vfpv3, or compile with --apcs=/hardfp. The ARM Linux ABI does not support hardware floating-point linkage. The compiler issues a warning to indicate this.

Related concepts
5.41 Compiler support for floating-point arithmetic
5.42 Default selection of hardware or software floating-point support
5.43 Example of hardware and software support differences for floating-point arithmetic
5.44 Vector Floating-Point (VFP) architectures
5.45 Limitations on hardware handling of floating-point arithmetic
5.46 Implementation of Vector Floating-Point (VFP) support code
5.47 Compiler and library support for half-precision floating-point numbers
5.48 Half-precision floating-point number format
5.49 Compiler support for floating-point computations and linkage
5.50 Types of floating-point linkage
Related reference
5.52 Floating-point linkage and computational requirements of compiler options
5.53 Processors and their implicit Floating-Point Units (FPUs)
8.6 --apcs=qualifier...qualifier
8.87 --fpu=name compiler option
8.113 --library_interface=lib
10.15 __softfp
10.98 #pragma softfp_linkage, #pragma no_softfp_linkage
Related information
Procedure Call Standard for the ARM Architecture
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.