NetBSD amd64: which way is the best for supporting 80 bits real/double?

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Thu May 11 03:07:32 PDT 2017


On Thursday, 11 May 2017 at 02:05:11 UTC, Nikolay wrote:
> I am porting LDC to NetBSD amd64, and I ask advice how to 
> handle real type. NetBSD has limited support for this type.

What is long double on NetBSD/amd64, 64-bit or full 80-bit?  We 
were talking about this when I was porting to Android/x86, where 
long double is 64-bit but the FPU should support 80-bit.  Iain 
suggested just sticking to the ABI, ie using 64-bit if that's how 
long double is defined (see next three comments after linked 
comment):

https://github.com/dlang/phobos/pull/2150#issuecomment-42731651

> This type exists, but standard library does not provide full 
> set of math functions for it (e.g. sinus, cosinus, and etc). 
> Currently I just forward all function calls to 64 bits version 
> counterparts, but in this case a set of unit tests are failing. 
> I see following approaches to handle this issue:
>    - Totally remove 80 bit real type from NetBSD port (make 
> real==double)
>    - Change tests and skip asserts for NetBSD
>
> There is one additional approach: implement these functions in 
> druntime, but it is too big/massive work for me.

I wouldn't worry about it too much.  If someone really needs 
this, they will have to chip in.  Dmd uses compiler intrinsics 
for those trig functions, and I notice that they seem to just 
call the native x86 asm instructions:

https://github.com/dlang/dmd/blob/master/src/ddmd/root/longdouble.c#L428


More information about the Digitalmars-d mailing list