English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 01 March 2018, 21:44   #1
JimDrew
Registered User

 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 577
80 bit precision for FPU emulation

I was just curious if there are any plans to add 80 bit precision for the FPU emulation. Now that the Vampire core has FPU, it's pretty apparent that the 80 bit precision is not optional for Mac emulations. The Mac uses the FPU for doing virtually everything within it's OS... even odd things like calculating window slider positions. There are numerous mainstream programs, along with quite a few plug-ins for Photoshop that do not work due to the lack of 80 bit precision in the FPU emulation.
JimDrew is offline  
Old 01 March 2018, 21:47   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,624
Funny, doesn't Basilisk 2 use UAE's 68k emulation?
idrougge is offline  
Old 01 March 2018, 22:04   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,784
Enable softfloat mode. It is 80-bit (and bit perfect accurate). Native mode is always 64-bit.
Toni Wilen is offline  
Old 01 March 2018, 22:20   #4
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,242
Never tried softfloat yet, but wasn't it a 64 bit limitation of the MS VC compiler that keeps WinUAE from supporting 80 bit floating point. Are you using a different compiler now or how is 80 bit softfloat integrated in WinUAE?
PeterK is offline  
Old 01 March 2018, 22:31   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,784
Quote:
Originally Posted by PeterK View Post
Never tried softfloat yet, but wasn't it a 64 bit limitation of the MS VC compiler that keeps WinUAE from supporting 80 bit floating point. Are you using a different compiler now or how is 80 bit softfloat integrated in WinUAE?
Yes, native FPU mode is 64-bit due to MSVC limit. Softfloat "emulates" floating point by using integer math.
Toni Wilen is offline  
Old 01 March 2018, 22:39   #6
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,242
But then you can only handle 80-bit floating point numbers as an array of integer (long)words with the compiler, like I did it once with the 80-bit constants. Or do you have another trick to deal with these numbers?

The problem is that "long double" does not exist in MSVC:
Attached Files
File Type: c FromOldFpp.c (4.2 KB, 18 views)

Last edited by PeterK; 02 March 2018 at 06:12.
PeterK is offline  
Old 02 March 2018, 10:07   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,784
What do you exactly ask?

Having 80-bit arrays of numbers won't help when you can't do any native operations with them. Unless there is some free to use library that implements all long double operations using hardware FPU.

Softfloat does not use any floating point numbers, everything uses integers (separated to 64-bit mantissa and 16-bit exponent part)
Toni Wilen is offline  
Old 02 March 2018, 14:40   #8
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,242
I just had a look into your softfloat source code at github and now I understand how you are handling the 80-bit floating point numbers. As you said, by using int32 for the exponent and uint64 for the mantissa. And it seems that you're using completely new softfloat subroutines like softfloat.cpp and softfloat_fpsp.cpp as an alternative to fpp.cpp. That was my question: how can fpp.cpp handle 80-bit floating point numbers? Answer: it's replaced.

My 80-bit array constants (xhex) are used in jit/compemu_fpp.cpp (line 1011 ...) for assigning the 80-bit numbers directly to the floating point registers. For example:
Quote:
fmov_ext_rm (dreg, uae_p32(&xhex_l10_2));
Similar to your softfloat method (using int32 and uint64) it should also be possible to support the 80-bit with the Intel FPU, at least for the Jit, but who wants to write that code?
PeterK is offline  
Old 02 March 2018, 14:55   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 21,784
No one wants to touch JIT code... And JIT only supports common routines, non-JIT functions still require support in non-JIT emulation.

Simple "wrapper" static link library compiled with compiler that has real long double support (input and output is usual 3*32-bit array) should do it, easy but also quite boring..
Toni Wilen is offline  
Old 02 March 2018, 15:40   #10
kolla
Registered User
kolla's Avatar
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,373
Quote:
Originally Posted by JimDrew View Post
The Mac uses the FPU for doing virtually everything within it's OS... even odd things like calculating window slider positions.
Really? That is odd, considering all the Mac models with just 68LC040 CPU that did not have FPU. For software, there was SoftwareFPU, specifically a Mac product - http://download.cnet.com/SoftwareFPU...94_4-4107.html
kolla is offline  
Old 02 March 2018, 15:48   #11
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,137
Quote:
Originally Posted by JimDrew View Post
The Mac uses the FPU for doing virtually everything within it's OS... even odd things like calculating window slider positions.
I'm afraid it's not the only one doing this kind of thing :/


Quote:
Originally Posted by kolla View Post
Really? That is odd, considering all the Mac models with just 68LC040 CPU that did not have FPU. For software, there was SoftwareFPU, specifically a Mac product - http://download.cnet.com/SoftwareFPU...94_4-4107.html
Mac OS has software calls for floating-point. I guess these are called all the time, and use the FPU where available.
meynaf is offline  
Old 06 March 2018, 20:16   #12
JimDrew
Registered User

 
Join Date: Dec 2013
Location: Lake Havasu City, AZ
Posts: 577
Correct. Apple uses math packages, which are floating point libraries. Packs 4 and 5 deal with floating point functions. When an 68LC040 is used, FPU routines are bypassed. SoftFPU is needed for anything that is not calling Apple system functions. It puts in a trap handler for FPU exceptions when calling an opcode that doesn't exist (LC040).

I will try out the softfloat mode. Thank, Toni!
JimDrew is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
SoftFloat FPU emulation arti support.WinUAE 6 10 July 2017 14:23
Emulated FPU precision michaljarz support.WinUAE 2 10 November 2016 10:33
FPU emulation elowan support.FS-UAE 8 31 January 2013 06:53
Possible FPU emulation bug in 2.5.1? Zoltar support.WinUAE 13 05 January 2013 14:52
Fpu emulation bug cefa68000 support.WinUAE 2 09 February 2007 19:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:24.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.10642 seconds with 15 queries