You copied the Doc URL to your clipboard.

Half-precision floating-point intrinsics

Arm® Compiler 6 provides BETA support for the ACLE defined Armv8.2-A half-precision floating-point intrinsics in AArch64 state.

Note

This topic describes a [BETA] feature. See Support level definitions.

To see the half-precision floating-point intrinsics, you can search for float16 from the list of intrinsics on Arm Developer.

arm_neon.h defines the intrinsics for the vector half-precision floating-point intrinsics.

arm_fp16.h defines the intrinsics for the scalar half-precision floating-point intrinsics.

The example below demonstrates the use of the half-precision floating-point intrinsics in AArch64 state.

// foo.c
#include <arm_neon.h>
#include <arm_fp16.h>

_Float16 goo(void)
{
   _Float16 a = 1.0f16;
   float16x4_t b = {1.0, 2.0, 3.0, 4.0};

    a = vabsh_f16(a); // scalar half-precision floating-point intrinsic
    b = vabs_f16(b);  // vector half-precision floating-point intrinsic

    return a;
}


To compile the example for AArch64 state, use the command:

armclang --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c90 -c foo.c -o foo.o

Note

Arm Compiler 6 does not support the half-precision floating-point intrinsics in AArch32 state. However, in AArch32, you can use the _Float16 data type, or use the Armv8.2 half-precision floating-point instructions in armclang inline or integrated assembly.
Was this page helpful? Yes No