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.
_mm256_cvtph_ps
as the "load" (convert half-float to float), and_mm256_cvtps_ph
as the "store" (convert float to half-float). It turns out this is reasonably fast, and is actually useful in situations where you're memory-constrained. Would it be acceptable, Nonyme, to implement this using intrinsics in something like a platform abstraction library? Or are you dead-set on having the compiler generate this code implicitly?