Yesterday I noticed some odd things and now wondering if Hatari emulates 68881/2 rounding control for FPU operations. I could have made a mistake somewhere but having checked the docs again and done tests it looks like a fault.
For example, this test code should perform chop rounding (round towards minus infinity). This is roughly equivalent to and'ing off the fraction of a fixed point number. i.e. if the value begins positive it remains positive and snaps towards 0. If it begins negative it remains negative and snaps towards -1.
fmove.l #0x60,fpcr; rounding mode -> single precision, towards smallest/-ve
fmove.l fp0,d0;
This however rounds positive numbers into negative numbers in Hatari when tested in practice.
Doing the same thing the manual way however...
...is mostly ignoring the rounding control flags and masks off the bits directly using the integer unit. This produces correct results (for at least the 16 msbs of the expanded mantissa). I.e. if the value starts positive the result is positive, likewise -ve numbers round towards -1.
The only difference here is the reliance on rounding control. Is that feature properly tied up in the WinUAE core?
I should add that rounding control is important for correct float/integer conversion in performance apps (like games!). If you need to apply clamping after conversion it adds a lot of overhead. I doubt anyone noticed on Falcon030 due to minimal use of FPU for performance stuff but it could upset CT60 compatibility at some point. It does affect something I'm working on just now also.
BTW following an earlier email about missing FPU opcodes in the debugger, here are a few cases I kept track of. There are probably others but I haven't really dug into it.
$020286 : f228 6400 0008 fmove.s 8(a0),fp0
$02028c : f21f DC.W $f21f
$02028e : d038 4fef add.b $4fef.w,d0
$020292 : 000c DC.W $000c
$020294 : 4e75 rts
$0201c4 : 4fef fff4 lea $fff4(sp),sp
$0201c8 : f227 DC.W $f227
$0201ca : e01c ror.b #8,d4
$0201cc : 206f 0034 movea.l $34(sp),a0
$0201d0 : 226f 0038 movea.l $38(sp),a1
$0201d4 : f211 4400 fmove.s (a1),fp0
$0201d8 : f229 4500 0004 fmove.s 4(a1),fp2
$0201de : f229 4480 0008 fmove.s 8(a1),fp1
$020062 : 4eb9 0003 c124 jsr $3c124
$020068 : 4fef 000c lea $c(sp),sp
$02006c : 3a6d 0006 movea.w 6(a5),a5
$020070 : 2f4d 0048 move.l a5,$48(sp)
$020074 : 4cdf 7c1c movem.l (sp)+,d2-d4/a2-a6
$020078 : f21f DC.W $f21f
$02007a : d038 6000 add.b $6000.w,d0
$02007e : fabe DC.W $fabe
$020080 : 2029 0008 move.l 8(a1),d0
$020084 : 6c00 ff20 bge $1ffa6