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]

denormal patch



This fixes a minor problem with denormals and soft-float that my
previous patch missed, and adds a test case (tip: never check
test-case results by eye...).

OK to commit?

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/egcs-denormal2.patch===============
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ChangeLog,v
retrieving revision 1.5995
diff -p -u -c -p -r1.5995 ChangeLog
*** ChangeLog	2000/03/20 23:47:38	1.5995
--- ChangeLog	2000/03/21 00:56:25
***************
*** 1,5 ****
--- 1,10 ----
  2000-03-20  Geoff Keating  <geoffk@cygnus.com>
  
+ 	* config/fp-bit.c (pack_d): Correct the case when a denormal
+ 	is rounded up and stops being denormal.
+ 
+ 2000-03-20  Geoff Keating  <geoffk@cygnus.com>
+ 
  	* config/rs6000/rs6000.md (bunordered): New expander.
  	(bordered): New expander.
  	(buneq): New expander.
Index: config/fp-bit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/fp-bit.c,v
retrieving revision 1.18
diff -p -u -c -p -r1.18 fp-bit.c
*** fp-bit.c	2000/03/16 17:20:57	1.18
--- fp-bit.c	2000/03/21 00:56:25
*************** pack_d ( fp_number_type *  src)
*** 518,527 ****
  	      fraction += GARDROUND;
  	    }
  	  /* Perhaps the rounding means we now need to change the
!              exponent.  */
! 	  if (fraction >= IMPLICIT_2)
  	    {
- 	      fraction >>= 1;
  	      exp += 1;
  	    }
  	  fraction >>= NGARDS;
--- 518,526 ----
  	      fraction += GARDROUND;
  	    }
  	  /* Perhaps the rounding means we now need to change the
!              exponent, because the fraction is no longer denormal.  */
! 	  if (fraction >= IMPLICIT_1)
  	    {
  	      exp += 1;
  	    }
  	  fraction >>= NGARDS;
Index: testsuite/gcc.c-torture/ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/ChangeLog,v
retrieving revision 1.64
diff -p -u -c -p -r1.64 ChangeLog
*** ChangeLog	2000/03/18 03:26:47	1.64
--- ChangeLog	2000/03/21 00:56:27
***************
*** 1,3 ****
--- 1,7 ----
+ 2000-03-20  Geoff Keating  <geoffk@cygnus.com>
+ 
+ 	* execute/ieee/20000320-1.c: New test for denormals.
+ 
  Fri Mar 10 01:15:19 2000  Hans-Peter Nilsson  <hp@bitrange.com>
  
  	* execute/divconst-2.c: Rewrite to check for standards-compliant
Index: testsuite/gcc.c-torture/execute/ieee/20000320-1.c
===================================================================
RCS file: 20000320-1.c
diff -N 20000320-1.c
*** /dev/null	Tue May  5 13:32:27 1998
--- 20000320-1.c	Mon Mar 20 16:56:27 2000
***************
*** 0 ****
--- 1,56 ----
+ typedef unsigned long long ull;
+ typedef unsigned int ul;
+ 
+ union fl {
+ 	float	f;
+ 	ul	l;
+ } uf;
+ union dl {
+ 	double	d;
+ 	ull	ll;
+ } ud;
+ 
+ int failed = 0;
+ 
+ void c(ull d, ul f)
+ {
+   ud.ll = d;
+   uf.f = (float) ud.d;
+   if (uf.l != f)
+     {
+       failed++;
+       printf("0x%08x.%08x => %08x (%.20g, %.10g)\n",
+ 	     (ul) (ud.ll >> 32), (ul) ud.ll, uf.l, ud.d, uf.f);
+     }
+ }
+ 
+ int main()
+ {
+     c(0x3690000000000000ULL, 0x00000000U);
+     c(0x3690000000000001ULL, 0x00000001U);
+     c(0x369fffffffffffffULL, 0x00000001U);
+     c(0x36A0000000000000ULL, 0x00000001U);
+     c(0x36A7ffffffffffffULL, 0x00000001U);
+     c(0x36A8000000000000ULL, 0x00000002U);
+     c(0x36AfffffffffffffULL, 0x00000002U);
+     c(0x36b0000000000000ULL, 0x00000002U);
+     c(0x36b0000000000001ULL, 0x00000002U);
+ 
+     c(0x380fffffdfffffffULL, 0x007fffffU);
+     c(0x380fffffe0000000ULL, 0x00800000U);
+     c(0x380fffffe0000001ULL, 0x00800000U);
+     c(0x380fffffffffffffULL, 0x00800000U);
+     c(0x3810000000000000ULL, 0x00800000U);
+     c(0x3810000000000001ULL, 0x00800000U);
+     c(0x3810000010000000ULL, 0x00800000U);
+     c(0x3810000010000001ULL, 0x00800001U);
+     c(0x381000002fffffffULL, 0x00800001U);
+     c(0x3810000030000000ULL, 0x00800002U);
+     c(0x3810000050000000ULL, 0x00800002U);
+     c(0x3810000050000001ULL, 0x00800003U);
+     
+     if (failed)
+       abort ();
+     else
+       exit (0);
+ }
============================================================

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