You copied the Doc URL to your clipboard.

Build options for floating-point arithmetic and linkage

To build code that carries out floating-point operations, you need to specify some floating-point build options.

You can compile your code to use either hardware or software floating-point arithmetic. To choose hardware floating-point arithmetic, specify a floating-point architecture, either explicitly, using the --fpu option, or implicitly in your choice of --cpu option.

When using hardware floating-point arithmetic, you also need to choose whether to use hardware or software floating-point procedure call linkage.

Hardware floating-point linkage means that floating-point arguments are passed to and returned from functions in floating-point registers. This is the most efficient choice.

Software floating-point linkage means that floating-point arguments are passed to and returned from functions in ARM integer registers. On architectures that support hardware floating-point arithmetic, this adds an overhead compared to hardware linkage because values must be transferred between integer and floating-point registers, which requires additional instructions. On architectures that do not support hardware floating-point arithmetic, software linkage is the only option.

The ARM software floating-point library, fplib, provides a set of floating-point functions that are built with software linkage. The variants of fplib divide into two main categories. The software variants use integer registers to perform floating-point arithmetic. The hardware variants transfer floating-point parameters from integer registers into floating-point registers then use a hardware floating-point instruction before moving the result back into an integer register. They give improved performance and reduced code size compared to the software variants.

It is important to ensure that the same linkage type is used consistently throughout your program. For example, if your code links with generic libraries, for example fplib, or legacy code that was built with software floating-point linkage, then your code also needs to be built with software linkage. This ensures that floating-point values can be passed to and returned from these libraries. You can specify the linkage type by using the --fpu option, but ARM recommends you use the --apcs option.

Was this page helpful? Yes No