English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   request.Other (https://eab.abime.net/forumdisplay.php?f=75)
-   -   Request: Long double (80bit) functions in x86/x64 assembly for WinUAE (https://eab.abime.net/showthread.php?t=91893)

Toni Wilen 18 April 2018 17:08

Request: Long double (80bit) functions in x86/x64 assembly for WinUAE
 
Another weird request, eab probably is wrong forum but...

Because MSVC does not support long doubles (they are alias to double. No, don't discuss any reasons here!) and I'd like to have host FPU emulated long double support (not everyone wants or needs slower bit perfect softfloat floating point emulation). So I'd like to do following ugly solution:

I need x86/x64 assembly file that has functions for each basic floating point function that takes two parameters, input (pointer to long double) and output (also pointer to long double)

For example following C code in x86/x64 assemly:

Code:

void fadd(void *srclongdouble, void *dstlongdouble)
{
    long double *src = (long double*)srclongdouble;
    long double *dst = (long double*)dstlongdouble;
    *dst = (*src) + (*dst);
}

Very simple but it needs to be in assembly. Use of mingw or cygwin gcc won't work because floating point calls most likely require extra link libraries and/or compiler's C-library, they may change FPU mode or do some other extra stuff that shouldn't be done. Linking it with MSVC would also get too messy.

Same for all other basic floating point functions. (sub, neg, mul, div etc..) but I am sure I can do them if I have one simple example (fadd) that handles weird x86 FPU stack stuff I don't want to know...

And functions to convert long double to int/double and back.

dalek 20 April 2018 05:56

Apologies as it's not exactly what you are after but have you considered the Berkeley Soft Float library? http://www.jhauser.us/arithmetic/SoftFloat.html It supports 80-bit double precision.

At worst it might be useful to compile it and see what the resulting assembly looks like for the functions you are after if noone can help.

Toni Wilen 20 April 2018 08:50

Softfloat is already used in softfloat mode but it is much slower than native FPU because it needs lots of integer calculations, some of them need to be 128 bit wide.

I want to use host FPU directly.

EDIT: I think I finally got it. (also: x86 syntax is ugly)


All times are GMT +2. The time now is 06:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05927 seconds with 11 queries