The __fp16
floating point data-type is a well known extension to the C standard used notably on ARM processors. I would like to run the IEEE version of them on my x86_64 processor. While I know they typically do not have that, I would be fine with emulating them with "unsigned short" storage (they have the same alignment requirement and storage space), and (hardware) float arithmetic.
Is there a way to request that in gcc?
I assume the rounding might be slightly "incorrect", but that is ok to me.
If this were to work in C++ too that would be ideal.
The issue with @Nonyme's solution is that using
clang -cc1
deprives you from all the implicit parameters that the clang driver provides (in particular, the implicit include paths to system headers). A better solution is to pass the__fp16
-related flags tocc1
through clang driver's-Xclang
parameter, as in: