06 May 2018, 14:24  #1 
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162

Load extended precision with .d operations
IIRC the 68060 has to emulate FMOVE.X #immediate,Fpn?
Let us assume I want to transfer an 80 bits extended precision constant (like Pi) into an FPU register without using the instruction above and without any memory access! What options do I have? Would it be possible with fmove.d/fadd.d, where the first fmove.d loads the most significant (52?) bits of the mantissa, while the fadd.d adds the remaining lower bits with an appropriate exponent? How to do that in a most elegant manner, i.e. how to determine the immediate values for both operations? 
06 May 2018, 16:12  #2 
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 186

Convert the original value to 96bit floatingpoint binary representation (for example, by assembling an FMOVE.X #IMM, FPn instruction). Extract the exponent and mantissa values separately. Split the mantissa field at 53 bits. Create two new sign/mantissa pairs. Convert these pairs either to hex representations of the 64bit float values or to decimal numbers.

06 May 2018, 20:41  #3 
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162

Thanks.
Ok. So, from the 96 bits representation I take first 53 bits of the mantissa and the exponent. Then, for the FADD, I take the remaining mantissa bits, and subtract 53 from the original exponent field? Something like this, I guess? 
06 May 2018, 21:04  #4 
Registered User
Join Date: Apr 2005
Location: Hangover
Posts: 2,231

Hi Frank,
looks like you are discussing a problem here which Cosmos also asked me about today. He has already found a solution. I think his method is to take a long double constant, subtract the double value of the same constant and convert the difference into a float value. This should work as long as the exponent of the long double was not too high. The missing 11 bits of the mantissa will always fit into a float value. Then use FMOVE.D #double,FPx ... and FADD.S #floatdiff,FPx. 
06 May 2018, 21:39  #5 
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162


07 May 2018, 08:45  #6  
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 186

Quote:
Tbh, if you have access to long double math operstions, then the Cosmos approach is less manual work and will give a nearidentical decomposition. 

07 May 2018, 13:52  #7  
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162

Quote:
Quote:


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Atomic operations between CPU & Blitter  leonard  Coders. Asm / Hardware  17  02 May 2018 04:43 
80 bit precision for FPU emulation  JimDrew  support.WinUAE  11  06 March 2018 20:16 
Emulated FPU precision  michaljarz  support.WinUAE  2  10 November 2016 10:33 
Logitech Precision gamepad hasn't worked since 2.3.3  Sigma  support.WinUAE  13  20 March 2013 09:29 
ClassicWB: file operations hang in Scalos but OK in Dopus  Quaxo76  project.ClassicWB  8  29 August 2010 11:09 

