diff -Nru -X .exclude-diff gcc-3.3.2/gcc/config/h8300/extfloatlib.c gcc-3.3.2-h8300/gcc/config/h8300/extfloatlib.c
--- gcc-3.3.2/gcc/config/h8300/extfloatlib.c	1970-01-01 09:00:00.000000000 +0900
+++ gcc-3.3.2-h8300/gcc/config/h8300/extfloatlib.c	2004-09-01 00:23:46.000000000 +0900
@@ -0,0 +1,69 @@
+/* from /gcc/config/m68k/fpgnulib.c */
+
+/* the following deal with IEEE single-precision numbers */
+#define EXCESS		126
+#define SIGNBIT		0x80000000
+#define HIDDEN		(1 << 23)
+#define SIGN(fp)	((fp) & SIGNBIT)
+#define EXP(fp)		(((fp) >> 23) & 0xFF)
+#define MANT(fp)	(((fp) & 0x7FFFFF) | HIDDEN)
+#define PACK(s,e,m)	((s) | ((e) << 23) | (m))
+
+/* the following deal with IEEE double-precision numbers */
+#define EXCESSD		1022
+#define HIDDEND		(1 << 20)
+#define EXPD(fp)	(((fp.l.upper) >> 20) & 0x7FF)
+#define SIGND(fp)	((fp.l.upper) & SIGNBIT)
+#define MANTD(fp)	(((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
+				(fp.l.lower >> 22))
+#define HIDDEND_LL	((long long)1 << 52)
+#define MANTD_LL(fp)	((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
+#define PACKD_LL(s,e,m)	(((long long)((s)+((e)<<20))<<32)|(m))
+
+/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */
+union double_long {
+    double d;
+#ifdef SWAP
+    struct {
+      unsigned long lower;
+      long upper;
+    } l;
+#else
+    struct {
+      long upper;
+      unsigned long lower;
+    } l;
+#endif
+    long long ll;
+};
+
+union float_long
+  {
+    float f;
+    long l;
+  };
+
+/* convert float to double */
+double
+__extendsfdf2 (float a1)
+{
+  union float_long fl1;
+  union double_long dl;
+  int exp;
+
+  fl1.f = a1;
+
+  if (!fl1.l)
+    {
+      dl.l.upper = dl.l.lower = 0;
+      return (dl.d);
+    }
+
+  dl.l.upper = SIGN (fl1.l);
+  exp = EXP (fl1.l) - EXCESS + EXCESSD;
+  dl.l.upper |= exp << 20;
+  dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
+  dl.l.lower = MANT (fl1.l) << 29;
+
+  return (dl.d);
+}
diff -Nru -X .exclude-diff gcc-3.3.2/gcc/config/h8300/float-h8300.h gcc-3.3.2-h8300/gcc/config/h8300/float-h8300.h
--- gcc-3.3.2/gcc/config/h8300/float-h8300.h	1970-01-01 09:00:00.000000000 +0900
+++ gcc-3.3.2-h8300/gcc/config/h8300/float-h8300.h	2004-01-17 23:59:05.000000000 +0900
@@ -0,0 +1,128 @@
+/* float.h for target h8300-elf with optional IEEE 32 bit double format: based float-sh.h */
+#ifndef _FLOAT_H_
+#define _FLOAT_H_
+#include "config/h8300/h8300.h"
+
+/* Produced by enquire version 4.3, CWI, Amsterdam */
+
+   /* Radix of exponent representation */
+#undef FLT_RADIX
+#define FLT_RADIX 2
+   /* Number of base-FLT_RADIX digits in the significand of a float */
+#undef FLT_MANT_DIG
+#define FLT_MANT_DIG 24
+   /* Number of decimal digits of precision in a float */
+#undef FLT_DIG
+#define FLT_DIG 6
+   /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
+#undef FLT_ROUNDS
+#define FLT_ROUNDS 1
+   /* Difference between 1.0 and the minimum float greater than 1.0 */
+#undef FLT_EPSILON
+#define FLT_EPSILON 1.19209290e-07F
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
+#undef FLT_MIN_EXP
+#define FLT_MIN_EXP (-125)
+   /* Minimum normalised float */
+#undef FLT_MIN
+#define FLT_MIN 1.17549435e-38F
+   /* Minimum int x such that 10**x is a normalised float */
+#undef FLT_MIN_10_EXP
+#define FLT_MIN_10_EXP (-37)
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
+#undef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
+   /* Maximum float */
+#undef FLT_MAX
+#define FLT_MAX 3.40282347e+38F
+   /* Maximum int x such that 10**x is a representable float */
+#undef FLT_MAX_10_EXP
+#define FLT_MAX_10_EXP 38
+
+   /* Number of base-FLT_RADIX digits in the significand of a double */
+#undef DBL_MANT_DIG
+#define DBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24)
+   /* Number of decimal digits of precision in a double */
+#undef DBL_DIG
+#define DBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6)
+   /* Difference between 1.0 and the minimum double greater than 1.0 */
+#undef DBL_EPSILON
+#define DBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16:1.19209290e-07F)
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
+#undef DBL_MIN_EXP
+#define DBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125))
+   /* Minimum normalised double */
+#undef DBL_MIN
+#define DBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308:1.17549435e-38F)
+   /* Minimum int x such that 10**x is a normalised double */
+#undef DBL_MIN_10_EXP
+#define DBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37))
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
+#undef DBL_MAX_EXP
+#define DBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128)
+   /* Maximum double */
+#undef DBL_MAX
+#define DBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308:3.40282347e+38F)
+   /* Maximum int x such that 10**x is a representable double */
+#undef DBL_MAX_10_EXP
+#define DBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38)
+
+/* Because -m3e and -m4-single-only have 32-bit doubles, we append L
+   to the doubles below, so that they're not truncated.  */
+
+   /* Number of base-FLT_RADIX digits in the significand of a long double */
+#undef LDBL_MANT_DIG
+#define LDBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24)
+   /* Number of decimal digits of precision in a long double */
+#undef LDBL_DIG
+#define LDBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6)
+   /* Difference between 1.0 and the minimum long double greater than 1.0 */
+#undef LDBL_EPSILON
+#define LDBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16L:1.19209290e-07F)
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
+#undef LDBL_MIN_EXP
+#define LDBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125))
+   /* Minimum normalised long double */
+#undef LDBL_MIN
+#define LDBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308L:1.17549435e-38F)
+   /* Minimum int x such that 10**x is a normalised long double */
+#undef LDBL_MIN_10_EXP
+#define LDBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37))
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
+#undef LDBL_MAX_EXP
+#define LDBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128)
+   /* Maximum long double */
+#undef LDBL_MAX
+#define LDBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308L:3.40282347e+38F)
+   /* Maximum int x such that 10**x is a representable long double */
+#undef LDBL_MAX_10_EXP
+#define LDBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38)
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# define DECIMAL_DIG	17
+
+#endif	/* C99 */
+
+#endif /*  _FLOAT_H_ */
diff -Nru -X .exclude-diff gcc-3.3.2/gcc/config/h8300/h8300.h gcc-3.3.2-h8300/gcc/config/h8300/h8300.h
--- gcc-3.3.2/gcc/config/h8300/h8300.h	2002-12-27 06:00:15.000000000 +0900
+++ gcc-3.3.2-h8300/gcc/config/h8300/h8300.h	2004-01-17 23:59:05.000000000 +0900
@@ -140,6 +140,8 @@
    alignment.  */
 #define TARGET_ALIGN_300 (target_flags & MASK_ALIGN_300)
 
+#define TARGET_MODE (target_flags & 16384)
+
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
    each pair being { "NAME", VALUE }
@@ -244,9 +246,9 @@
 #define SHORT_TYPE_SIZE	16
 #define INT_TYPE_SIZE		(TARGET_INT32 ? 32 : 16)
 #define LONG_TYPE_SIZE		32
-#define LONG_LONG_TYPE_SIZE	32
+#define LONG_LONG_TYPE_SIZE	(TARGET_INT32 ? 64 : 32)
 #define FLOAT_TYPE_SIZE	32
-#define DOUBLE_TYPE_SIZE	32
+#define DOUBLE_TYPE_SIZE	(TARGET_INT32 ? 64 : 32)
 #define LONG_DOUBLE_TYPE_SIZE	DOUBLE_TYPE_SIZE
 
 #define MAX_FIXED_MODE_SIZE	32
@@ -1303,4 +1305,20 @@
 
 #define MOVE_RATIO 3
 
+#ifdef IN_LIBGCC2
+#undef LONG_LONG_TYPE_SIZE
+#undef DOUBLE_TYPE_SIZE
+#undef LONG_DOUBLE_TYPE_SIZE
+#if __INT_MAX__ == 32767
+#define DI SI
+#define DF SF
+#define LONG_LONG_TYPE_SIZE 32
+#define DOUBLE_TYPE_SIZE 32
+#else
+#define LONG_LONG_TYPE_SIZE 64
+#define DOUBLE_TYPE_SIZE 64
+#endif
+#define LONG_DOUBLE_TYPE_SIZE	DOUBLE_TYPE_SIZE
+#endif
+
 #endif /* ! GCC_H8300_H */
diff -Nru -X .exclude-diff gcc-3.3.2/gcc/config/h8300/t-h8300 gcc-3.3.2-h8300/gcc/config/h8300/t-h8300
--- gcc-3.3.2/gcc/config/h8300/t-h8300	2002-11-20 13:54:39.000000000 +0900
+++ gcc-3.3.2-h8300/gcc/config/h8300/t-h8300	2004-09-01 22:50:07.000000000 +0900
@@ -5,24 +5,39 @@
 LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
   _floatdisf _fixsfdi _fixunssfdi _fixunssfsi_asm
 
-LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c
-
-# We do not have DF or DI types, so fake out the libgcc2 compilation.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF -DDI=SI
+LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/extfloatlib.c
 
 # We want fine grained libraries, so use the new code to build the
 # floating point emulation libraries.
 FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define SMALL_MACHINE' >> dp-bit.c
+	echo '#ifdef __H8300__' >> dp-bit.c
+	echo '#define CMPtype HItype' >> dp-bit.c
+	echo '#else' >> dp-bit.c
+	echo '#define CMPtype SItype' >> dp-bit.c
+	echo '#endif' >> dp-bit.c
+	echo '#if __INT_MAX__ == 32767' >> dp-bit.c
+	echo '#define NO_DI_MODE' >> dp-bit.c
+	echo '#endif' >> dp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> dp-bit.c
 
 fp-bit.c: $(srcdir)/config/fp-bit.c
 	echo '#define FLOAT' > fp-bit.c
+	echo '#if __INT_MAX__ != 32767' >> fp-bit.c
 	echo '#define FLOAT_ONLY' >> fp-bit.c
+	echo '#endif' >> fp-bit.c
 	echo '#define SMALL_MACHINE' >> fp-bit.c
 	echo '#ifdef __H8300__' >> fp-bit.c
 	echo '#define CMPtype HItype' >> fp-bit.c
 	echo '#else' >> fp-bit.c
 	echo '#define CMPtype SItype' >> fp-bit.c
 	echo '#endif' >> fp-bit.c
+	echo '#if __INT_MAX__ == 32767' >> fp-bit.c
+	echo '#define NO_DI_MODE' >> fp-bit.c
+	echo '#endif' >> fp-bit.c
 	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
 
 MULTILIB_OPTIONS = mh/ms mn mint32

