2

I'm trying to use type __fp16 (half precision float) in program compiled with GNU ARM C++ Compiler however whenever I try to declare variable of this type I get an error message __fp16 is not declared. I assume that it's caused by the fact that I lack some header file, but I was unable to find any data on which header it might be. Does anybody know where it's defined / what shall I include?

phuclv
  • 37,963
  • 15
  • 156
  • 475
Axel
  • 61
  • 1
  • 8

1 Answers1

4

Yes the target supports half precision operations; it doesn't support doubles.

I got a reply from the GNU team. The solution is to add the compiler command -mfp16-format=ieee. That defines __fp16 to ieee standard (see https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html)

phuclv
  • 37,963
  • 15
  • 156
  • 475
Axel
  • 61
  • 1
  • 8
  • 1
    [*The `_Float16` type is supported on AArch64 systems by default, and on ARM systems when the IEEE format for 16-bit floating-point types is selected with `-mfp16-format=ieee`*](https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html) – phuclv Oct 19 '20 at 23:40