This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: testsuite/gcc.c-torture/execute/ieee/20000320-1.c


Many MIPS chips round denormalized floating point numbers to zero
rather than follow the IEEE standard.  Change the rounding mode to
correspond to the IEEE rounding mode that rounds numbers to the
nearest representable mode, the most common IEEE rounding mode.

2001-01-25  Jeffrey Oldham  <oldham@codesourcery.com>

        * gcc.c-torture/execute/ieee/20000320-1.c (main): For MIPS, change
        floating point number rounding mode to round to the nearest
        representable mode.

Tested on       mips-sgi-irix6.5 and i686-pc-linux-gnu
Approved by     Mark Mitchell (mark@codesourcery.com)

Thanks,
Jeffrey D. Oldham
oldham@codesourcery.com
Index: 20000320-1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/execute/ieee/20000320-1.c,v
retrieving revision 1.1
diff -c -p -r1.1 20000320-1.c
*** 20000320-1.c	2000/03/23 01:24:15	1.1
--- 20000320-1.c	2001/01/24 06:38:14
***************
*** 1,3 ****
--- 1,6 ----
+ #if defined(__mips__) && defined(__sgi__)
+ #include <sys/fpu.h>
+ #endif /* defined(__mips__) && defined(__sgi__) */
  #include <limits.h>
  #if UINT_MAX != 4294967295u || (ULONG_LONG_MAX != 18446744073709551615ull && ULONG_MAX != 18446744073709551615ull)
  int main(void) { exit (0); }
*************** void c(ull d, ul f)
*** 32,37 ****
--- 35,49 ----
  
  int main()
  {
+ #if defined(__mips__) && defined(__sgi__)
+   /* Many MIPS chips round denormalized floating point numbers to zero
+      rather than follow the IEEE standard.  Change the rounding mode
+      to correspond to the IEEE rounding mode that rounds numbers to
+      the nearest representable mode, the most common IEEE rounding
+      mode.  */
+   set_fpc_csr(0);
+ #endif /* defined(__mips__) && defined(__sgi__) */
+ 
    if (sizeof (float) != sizeof (ul)
        || sizeof (double) != sizeof (ull))
      exit (0);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]