PATCH (update of): Support semi-unique FreeBSD/i386 FP setup

Loren James Rittle rittle@latour.rsch.comm.mot.com
Tue Jun 24 10:15:00 GMT 2003


Some time ago (well before the 3.3 release), RTH reworked FP support
in gcc.  I raised some issues I was seeing on FreeBSD/i386 with the
change.  The upshot is that FreeBSD has (a) a fairly unique setup of
its FP hardware; (b) some bugs in its system headers (fairly moot
since the libc didn't really support long double, at least in FreeBSD
4).  Richard was kind enough to add support for this situation and
gave me the configuration patch.  I promised to work this issue.  And
it was my hope that this patch would never have to be installed.

Anyways, (a) still exists and (b) was improved yet not entirely fixed.
gcc 3.3.X is about to be imported as the system compiler...

Here is RTH's original patch, which I've updated as required over the
many moons.  OK for mainline? (with the expectation that it will hit
3.3.X after I test in that context; it has been in my private mainline
bootstrap tree since I got it; FP-related dejagnu test cases may fail
with or without the patch, as near as I've debugged, depending upon
what assumptions they make; I suppose I should mark the failure
profile but it never really was a high priority given the flux.)

	* real.h (ieee_extended_intel_96_round_53_format): New.
	* real.c (ieee_extended_intel_96_round_53_format): New.
	* config/i386/freebsd.h (SUBTARGET_OVERRIDE_OPTIONS): Use it
	for XFmode and TFmode.

Index: gcc/real.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.h,v
retrieving revision 1.67
diff -c -r1.67 real.h
*** gcc/real.h	23 Jun 2003 15:27:37 -0000	1.67
--- gcc/real.h	24 Jun 2003 07:20:55 -0000
***************
*** 234,239 ****
--- 234,240 ----
  extern const struct real_format mips_double_format;
  extern const struct real_format ieee_extended_motorola_format;
  extern const struct real_format ieee_extended_intel_96_format;
+ extern const struct real_format ieee_extended_intel_96_round_53_format;
  extern const struct real_format ieee_extended_intel_128_format;
  extern const struct real_format ibm_extended_format;
  extern const struct real_format mips_extended_format;
Index: gcc/real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.120
diff -c -r1.120 real.c
*** gcc/real.c	12 Jun 2003 19:01:08 -0000	1.120
--- gcc/real.c	24 Jun 2003 07:20:55 -0000
***************
*** 3326,3331 ****
--- 3326,3350 ----
      true
    };
  
+ /* The following caters to i386 systems that set the rounding precision
+    to 53 bits instead of 64, e.g. FreeBSD.  */
+ const struct real_format ieee_extended_intel_96_round_53_format = 
+   {
+     encode_ieee_extended,
+     decode_ieee_extended,
+     2,
+     1,
+     53,
+     53,
+     -16381,
+     16384,
+     79,
+     true,
+     true,
+     true,
+     true,
+     true
+   };
  
  /* IBM 128-bit extended precision format: a pair of IEEE double precision
     numbers whose sum is equal to the extended precision value.  The number
Index: gcc/config/i386/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/freebsd.h,v
retrieving revision 1.35
diff -c -r1.35 freebsd.h
*** gcc/config/i386/freebsd.h	4 Jun 2003 15:23:40 -0000	1.35
--- gcc/config/i386/freebsd.h	24 Jun 2003 07:20:55 -0000
***************
*** 133,135 ****
--- 130,142 ----
  
  #undef  DEFAULT_PCC_STRUCT_RETURN
  #define DEFAULT_PCC_STRUCT_RETURN 0
+ 
+ /* FreeBSD sets the rounding precision of the FPU to 53 bits.  Let the
+    compiler get the contents of <float.h> and std::numeric_limits correct.  */
+ #define SUBTARGET_OVERRIDE_OPTIONS			\
+   do {							\
+     real_format_for_mode[XFmode - QFmode]		\
+       = &ieee_extended_intel_96_round_53_format;	\
+     real_format_for_mode[TFmode - QFmode]		\
+       = &ieee_extended_intel_96_round_53_format;	\
+   } while (0)



More information about the Gcc-patches mailing list