Subject: pkg/34691: TME sun3 emulator sometimes incorrectly performs fmove.x
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 10/01/2006 19:25:00
>Number:         34691
>Category:       pkg
>Synopsis:       TME sun3 emulator sometimes incorrectly performs fmove.x
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 01 19:25:00 +0000 2006
>Originator:     Arthur Townsend
>Release:        3.0
3.0 for i386
gcc 3.3.3 testcase gcc.c-torture/execute/conversion.c running under Netbsd 3.0 aborts inside TME, and runs fine on a real sun3.
the following is a short version of an example that doesn't run correctly:

#include <stdio.h>

long double
     unsigned long long int u;
  return u;

  long double a, b;

  a = ull2ld(~0ULL);
  b = (long double) ~0ULL;
  if(a!=b) abort();


The specific problem can be observed by running in gdb, then stopping at line 0x286c as shown below.
The line at 0x2864 puts the value 65536 inside fp0, but the next line, instead of  copying 65536 from fp0 to fp1, instead slightly changes the value of fp0, and hoses fp1.

(gdb) disas 0x02854
Dump of assembler code for function __floatdixf:
0x2854 <__floatdixf>:   linkw %fp,#0
0x2858 <__floatdixf+4>: fmovemx %fp2,%sp@-
0x285c <__floatdixf+8>: movel %fp@(8),%d0
0x2860 <__floatdixf+12>:        movel %fp@(12),%d1
0x2864 <__floatdixf+16>:        fmoves #65536,%fp0
0x286c <__floatdixf+24>:        fmovex %fp0,%fp1
0x2870 <__floatdixf+28>:        fmull %fp@(8),%fp1
0x2876 <__floatdixf+34>:        fmulx %fp0,%fp1
0x287a <__floatdixf+38>:        fmovel %d1,%fp2
0x287e <__floatdixf+42>:        tstl %d1
0x2880 <__floatdixf+44>:        bges 0x288e <__floatdixf+58>
0x2882 <__floatdixf+46>:        fmoves #4.29497e+09,%fp0
0x288a <__floatdixf+54>:        faddx %fp0,%fp2
0x288e <__floatdixf+58>:        faddx %fp2,%fp1
0x2892 <__floatdixf+62>:        fmovex %fp1,%fp0
0x2896 <__floatdixf+66>:        fmovemx %sp@+,%fp2
0x289a <__floatdixf+70>:        unlk %fp
0x289c <__floatdixf+72>:        rts
0x289e <__floatdixf+74>:        rts
End of assembler dump.