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]
Other format: [Raw text]

[PATCH] real.c constants


	While debugging the GLOBALIZE problem, I ran into a strange
ordering of real.c where the various "e" constants are declared extern,
referenced, defined, and referenced again.  The definition after use
causes GCC to change its concept of those variables midway through the
compilation generating worse code.

David


	* real.c (ezero, ehalf, etwo, e32, elog2, esqrt2, epi): Remove
	forward declaration and define before uses.

Index: real.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/real.c,v
retrieving revision 1.75
diff -c -p -r1.75 real.c
*** real.c	12 Aug 2002 15:50:43 -0000	1.75
--- real.c	22 Aug 2002 21:49:50 -0000
*************** static const struct ieee_format dec_h =
*** 410,418 ****
  #endif
  #endif /* DEC */
  
  extern int extra_warnings;
- extern const UEMUSHORT ezero[NE], ehalf[NE], eone[NE], etwo[NE];
- extern const UEMUSHORT elog2[NE], esqrt2[NE];
  
  static void endian	PARAMS ((const UEMUSHORT *, long *,
  			       enum machine_mode));
--- 410,479 ----
  #endif
  #endif /* DEC */
  
+ /*  e type constants used by high precision check routines */
+ 
+ #if MAX_LONG_DOUBLE_TYPE_SIZE == 128 && (INTEL_EXTENDED_IEEE_FORMAT == 0)
+ /* 0.0 */
+ const UEMUSHORT ezero[NE] =
+  {0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
+ 
+ /* 5.0E-1 */
+ const UEMUSHORT ehalf[NE] =
+  {0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,};
+ 
+ /* 1.0E0 */
+ const UEMUSHORT eone[NE] =
+  {0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
+ 
+ /* 2.0E0 */
+ const UEMUSHORT etwo[NE] =
+  {0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,};
+ 
+ /* 3.2E1 */
+ const UEMUSHORT e32[NE] =
+  {0x0000, 0x0000, 0x0000, 0x0000,
+   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,};
+ 
+ /* 6.93147180559945309417232121458176568075500134360255E-1 */
+ const UEMUSHORT elog2[NE] =
+  {0x40f3, 0xf6af, 0x03f2, 0xb398,
+   0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
+ 
+ /* 1.41421356237309504880168872420969807856967187537695E0 */
+ const UEMUSHORT esqrt2[NE] =
+  {0x1d6f, 0xbe9f, 0x754a, 0x89b3,
+   0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
+ 
+ /* 3.14159265358979323846264338327950288419716939937511E0 */
+ const UEMUSHORT epi[NE] =
+  {0x2902, 0x1cd1, 0x80dc, 0x628b,
+   0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
+ 
+ #else
+ /* LONG_DOUBLE_TYPE_SIZE is other than 128 */
+ const UEMUSHORT ezero[NE] =
+  {0, 0000000, 0000000, 0000000, 0000000, 0000000,};
+ const UEMUSHORT ehalf[NE] =
+  {0, 0000000, 0000000, 0000000, 0100000, 0x3ffe,};
+ const UEMUSHORT eone[NE] =
+  {0, 0000000, 0000000, 0000000, 0100000, 0x3fff,};
+ const UEMUSHORT etwo[NE] =
+  {0, 0000000, 0000000, 0000000, 0100000, 0040000,};
+ const UEMUSHORT e32[NE] =
+  {0, 0000000, 0000000, 0000000, 0100000, 0040004,};
+ const UEMUSHORT elog2[NE] =
+  {0xc9e4, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
+ const UEMUSHORT esqrt2[NE] =
+  {0x597e, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
+ const UEMUSHORT epi[NE] =
+  {0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
+ #endif
+ 
  extern int extra_warnings;
  
  static void endian	PARAMS ((const UEMUSHORT *, long *,
  			       enum machine_mode));
*************** static void eshdn8	PARAMS ((UEMUSHORT *)
*** 452,458 ****
  static void eshup8	PARAMS ((UEMUSHORT *));
  static void eshup6	PARAMS ((UEMUSHORT *));
  static void eshdn6	PARAMS ((UEMUSHORT *));
! static void eaddm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
  static void esubm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
  static void m16m	PARAMS ((unsigned int, const UEMUSHORT *, UEMUSHORT *));
  static int edivm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
--- 513,519 ----
  static void eshup8	PARAMS ((UEMUSHORT *));
  static void eshup6	PARAMS ((UEMUSHORT *));
  static void eshdn6	PARAMS ((UEMUSHORT *));
! static void eaddm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
  static void esubm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
  static void m16m	PARAMS ((unsigned int, const UEMUSHORT *, UEMUSHORT *));
  static int edivm	PARAMS ((const UEMUSHORT *, UEMUSHORT *));
*************** ereal_isneg (x)
*** 1593,1661 ****
  #define TLOSS		5	/* total loss of precision */
  #define PLOSS		6	/* partial loss of precision */
  #define INVALID		7	/* NaN-producing operation */
- 
- /*  e type constants used by high precision check routines */
- 
- #if MAX_LONG_DOUBLE_TYPE_SIZE == 128 && (INTEL_EXTENDED_IEEE_FORMAT == 0)
- /* 0.0 */
- const UEMUSHORT ezero[NE] =
-  {0x0000, 0x0000, 0x0000, 0x0000,
-   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
- 
- /* 5.0E-1 */
- const UEMUSHORT ehalf[NE] =
-  {0x0000, 0x0000, 0x0000, 0x0000,
-   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,};
- 
- /* 1.0E0 */
- const UEMUSHORT eone[NE] =
-  {0x0000, 0x0000, 0x0000, 0x0000,
-   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
- 
- /* 2.0E0 */
- const UEMUSHORT etwo[NE] =
-  {0x0000, 0x0000, 0x0000, 0x0000,
-   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,};
- 
- /* 3.2E1 */
- const UEMUSHORT e32[NE] =
-  {0x0000, 0x0000, 0x0000, 0x0000,
-   0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,};
- 
- /* 6.93147180559945309417232121458176568075500134360255E-1 */
- const UEMUSHORT elog2[NE] =
-  {0x40f3, 0xf6af, 0x03f2, 0xb398,
-   0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
- 
- /* 1.41421356237309504880168872420969807856967187537695E0 */
- const UEMUSHORT esqrt2[NE] =
-  {0x1d6f, 0xbe9f, 0x754a, 0x89b3,
-   0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
- 
- /* 3.14159265358979323846264338327950288419716939937511E0 */
- const UEMUSHORT epi[NE] =
-  {0x2902, 0x1cd1, 0x80dc, 0x628b,
-   0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
- 
- #else
- /* LONG_DOUBLE_TYPE_SIZE is other than 128 */
- const UEMUSHORT ezero[NE] =
-  {0, 0000000, 0000000, 0000000, 0000000, 0000000,};
- const UEMUSHORT ehalf[NE] =
-  {0, 0000000, 0000000, 0000000, 0100000, 0x3ffe,};
- const UEMUSHORT eone[NE] =
-  {0, 0000000, 0000000, 0000000, 0100000, 0x3fff,};
- const UEMUSHORT etwo[NE] =
-  {0, 0000000, 0000000, 0000000, 0100000, 0040000,};
- const UEMUSHORT e32[NE] =
-  {0, 0000000, 0000000, 0000000, 0100000, 0040004,};
- const UEMUSHORT elog2[NE] =
-  {0xc9e4, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
- const UEMUSHORT esqrt2[NE] =
-  {0x597e, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
- const UEMUSHORT epi[NE] =
-  {0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
- #endif
  
  /* Control register for rounding precision.
     This can be set to 113 (if NE=10), 80 (if NE=6), 64, 56, 53, or 24 bits.  */
--- 1654,1659 ----


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