[LLVMdev] quad precision floating point emulation

Tim Northover t.p.northover at gmail.com
Fri Jun 5 07:04:20 PDT 2015


On 4 June 2015 at 20:58, Peter McKinna <peter.mckinna at gmail.com> wrote:
> Examining the stack after the return from __addtf3 y seems to be
> 0xfffffffffff (roughly)

We seem to be using entirely the wrong calling convention (though we
do pass everything somewhere: %rdi, %rsi, %rcx and %rdx contain the
right info). According to the AMD64 SysV ABI, __float128 types should
be passed and returned in %xmm regs.

I had thought Clang supported __float128. But apparently it doesn't,
which would explain why this is broken -- probably no-one has tested
it on amd64.

> Should I be linking in the compiler_rt lib ?

That might "fix" it, as the two bugs cancel each other out. But your
code wouldn't be interoperable with anything else using __float128.

Unfortunately the real fix is in the x86 backend, and not exactly
trivial (I had to do a similar implementation in the AArch64 backend,
and types that are only really legal for parameter passing are a pain
to implement).

Cheers.

Tim.



More information about the llvm-dev mailing list