The ARM Compiler toolchain does not support floating-point exception trapping for AArch64 targets.

Some older versions of the ARM libraries implemented a function called __fp_status() that manipulated a status word in the floating-point environment. This is the same as __ieee_status() but it uses an older style of status word layout.

The function prototype for __fp_status() is:

unsigned int __fp_status(unsigned int mask, unsigned int flags);


This function requires a floating-point model that supports exceptions. In ARM Compiler 6 this is enabled by default, and is disabled by armclang command-line options such as -ffast-math.

The layout of the status word as seen by __fp_status() is shown in Figure 1.

Figure 1. Floating-point status word layout

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

The fields in Figure 1 are as follows:

The rounding mode cannot be changed with the __fp_status() call.

In addition to defining the __fp_status() call itself, stdlib.h also defines the following constants to be used for the arguments:

#define __fpsr_IXE  0x100000
#define __fpsr_UFE  0x80000
#define __fpsr_OFE  0x40000
#define __fpsr_DZE  0x20000
#define __fpsr_IOE  0x10000
#define __fpsr_IXC  0x10
#define __fpsr_UFC  0x8
#define __fpsr_OFC  0x4
#define __fpsr_DZC  0x2
#define __fpsr_IOC  0x1

For example, to trap the Invalid Operation exception and untrap all other exceptions, you would call __fp_status() with the following input parameters:

__fp_status(_fpsr_IXE | _fpsr_UFE | _fpsr_OFE |
            _fpsr_DZE | _fpsr_IOE, _fpsr_IOE);

To untrap the Inexact Result exception:

__fp_status(_fpsr_IXE, 0);

To clear the Underflow sticky flag:

__fp_status(_fpsr_UFC, 0);

Show/hideSee also


ARM C and C++ Libraries and Floating-Point Support User Guide:

Copyright © 2014 ARM. All rights reserved.ARM DUI 0809A