simon_tatham added inline comments.

================
Comment at: docs/LanguageExtensions.rst:457
+that arithmetic on ``_Float16`` is performed in half-precision, thus it is not
+a storage-only format. It is recommended that portable code use the
+``_Float16`` type.
----------------
I think the use of "portable" here doesn't really give enough detail.

From an ARM-specific perspective, source code using `_Float16` will be compiled 
into code that uses the hardware FP instructions for arithmetic on 16-bit FP 
values which were introduced in ARMv8.2, whereas `__fp16` will be compiled into 
code that only uses the instructions to convert 16-bit to and from 32-bit, from 
a much earlier architecture revision. So from that perspective, using 
`_Float16` will //reduce// portability, because it will make your code run (or 
at least run at full hardware-FP speed) on a smaller set of CPUs.

On the other hand, from a source language perspective, `__fp16` is defined in 
an ARM-specific language extension, whereas `_Float16` is defined by the C 
standards committee. So if your portability concern is between entire 
architectures, rather than between versions of the ARM architecture, then using 
`_Float16` probably does help.

So I think it would probably be better to make some of this explicit – don't 
just say one or the other type is "more portable", but say something more 
specific about the circumstances in which each one can be expected to work.


https://reviews.llvm.org/D35295



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to