English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 06 May 2018, 14:24   #1
phx
Natteravn

phx's Avatar
 
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?
phx is offline  
Old 06 May 2018, 16:12   #2
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 186
Convert the original value to 96-bit floating-point 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 64-bit float values or to decimal numbers.
Kalms is offline  
Old 06 May 2018, 20:41   #3
phx
Natteravn

phx's Avatar
 
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?
phx is offline  
Old 06 May 2018, 21:04   #4
PeterK
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.
PeterK is offline  
Old 06 May 2018, 21:39   #5
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162
Quote:
Originally Posted by PeterK View Post
looks like you are discussing a problem here which Cosmos also asked me about today.
LOL
Indeed.

Quote:
He has already found a solution.
I know. But I was curious to hear other opinions.
phx is offline  
Old 07 May 2018, 08:45   #6
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 186
Quote:
Originally Posted by phx View Post
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?
Almost. You need to handle the implicit leading 1-bit for the mantissa. The exponent for the remaining value may then become smaller than (original exponent - 53). Extreme example: what if the lowest bits of the mantissa are all zero?

Tbh, if you have access to long double math operstions, then the Cosmos approach is less manual work and will give a near-identical decomposition.
Kalms is offline  
Old 07 May 2018, 13:52   #7
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,162
Quote:
Originally Posted by Kalms View Post
Extreme example: what if the lowest bits of the mantissa are all zero?
Right. It's not so trivial. I nearly forgot about the implicit 1-bit, which is always there and also determines the exponent.

Quote:
Tbh, if you have access to long double math operstions, then the Cosmos approach is less manual work and will give a near-identical decomposition.
Ok. That's what I wanted to find out. Thanks.
phx 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
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

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 03:09.


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