Floating Point Unit (FPU) Intrinsics

The following intrinsics perform faster floating point calculations using the 32-bit (FPU32) and 64-bit (FPU64) hardware floating-point support. These intrinsics are enabled if the --float_support compiler option is set to fpu32 or fpu64, respectively.

If you are using the COFF ABI, arguments and return values listed as floats may also use doubles, because both are 32-bit types. The FPU32 intrinsics are supported, but the FPU64 intrinsics are not supported if you are using the COFF ABI.

If you are using EABI, the float type is 32-bit and the double type is 64-bit. If FPU32 is enabled, use only the FPU32 versions. In general, if FPU64 is enabled, you may use both FPU32 and FPU64 intrinsics. However, in EABI mode with FPU64, there is no instruction that swaps two 32-bit floats. In this situation, you cannot use the __swapf() intrinsic, and the __swapff() intrinsic must only be used with 64-bit doubles.

Table 7-7 C/C++ Compiler Intrinsics for FPU

FPU Version Intrinsic Assembly Instruction(s) Description
FPU32 float __einvf32( float x); EINVF32x Compute and return 1/x to about 8 bits of precision.
FPU64 double __einvf64( double x); EINVF64x Compute and return 1/x to about 8 bits of precision.
FPU32 float __eisqrtf32( float x); EISQRTF32x Find the square root of 1/x to about 8 bits of precision.
FPU64 double __eisqrtf64( double x); EISQRTF64x Find the square root of 1/x to about 8 bits of precision.
FPU32 void __f32_max_idx( float &dst, float src,
    float &idx_dst, float idx_src);
MAXF32dst, src
|| MOV32idx_dst, idx_src
If src>dst, copy src to dst, and copy idx_src to idx_dst.
FPU64 void __f64_max_idx( double &dst, double src,
    double &idx_dst, double idx_src);
MAXF64dst, src
|| MOV64idx_dst, idx_src
If src>dst, copy src to dst, and copy idx_src to idx_dst.
FPU32 void __f32_min_idx( float &dst, float src,
    float &idx_dst, float idx_src);
MINF32dst, src
|| MOV32idx_dst, idx_src
If src<dst, copy src to dst, and copy idx_src to idx_dst.
FPU64 void __f64_min_idx( double &dst, double src,
   double &idx_dst, double idx_src);
MINF64dst, src
|| MOV64idx_dst, idx_src
If src<dst, copy src to dst, and copy idx_src to idx_dst.
FPU32 int __f32toi16r(float src); F32TOI16Rdst,src Convert float to int and round.
FPU32 unsigned int __f32toui16r(float src); F32TOUI16Rdst,src Convert float to unsigned int and round.
FPU32 float __fmax( float x, float y); MAXF32dst, src If src>dst, copy src to dst.
FPU64 double __fmax64( double x, double y); MAXF64dst, src If src>dst, copy src to dst.
FPU32 float __fmin( float x, float y); MINF32dst, src If src<dst, copy src to dst.
FPU64 double __fmin64( double x, double y); MINF64dst, src If src<dst, copy src to dst.
FPU32 float __fracf32(float src); FRACF32dst,src Return the fractional portion of src.
FPU64 double __fracf64(double src); FRACF64dst,src Return the fractional portion of src.
FPU32 float __fsat(float val, float max, float min); MAXF32dst,src2
MINF32dst, src1
Return val if min < val < max. Else return min if value < min. Else return max if val > max.
FPU32 (only) void __swapf( float &a, float &b); swapfa, b Swap the contents of a and b.
FPU32 (only) void __swapff( float &a, float &b); swapffa, b Swap the contents of a and b.
FPU64 void __swapff( double &a, double &b); swapffa, b Swap the contents of a and b.