[cfe-dev] [RFC] implementation of _Float16

Tim Northover via cfe-dev cfe-dev at lists.llvm.org
Thu May 11 15:54:15 PDT 2017


On 10 May 2017 at 09:39, Hal Finkel via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> By "when required", do you mean when the result would be the same as if the
> operation had been performed in single precision? If so, then no, we need
> different semantics.

I don't follow here. I've discussed this before (with Steve Canon, so
if he says anything that contradicts me, ignore me), and I was
convinced that all of LLVM's primitive operations have the same
semantics as half as when promoted to float and then truncated again
(including sqrt, but not fma I believe).

So as far as I know the situation right now is that we miscompile
@llvm.fma.f16 with an extra fpext/fptrunc. That could be a problem if
Clang emits that for __fp16, but I haven't managed to make it do so
yet ("fp contract" seems to give a fmuladd with correct promotions
etc).

Other than that, transcendentals are pattern-matched so shouldn't
cause compatibility issues.

Do you have any more specific worries?

Cheers.

Tim.



More information about the cfe-dev mailing list