diff -Nru gcc-3.2.1/gcc/config/float-h8300.h gcc-3.2.1-h8300/gcc/config/float-h8300.h --- gcc-3.2.1/gcc/config/float-h8300.h 1970-01-01 09:00:00.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config/float-h8300.h 2003-10-10 02:14:45.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 gcc-3.2.1/gcc/config/h8300/extfloatlib.c gcc-3.2.1-h8300/gcc/config/h8300/extfloatlib.c --- gcc-3.2.1/gcc/config/h8300/extfloatlib.c 1970-01-01 09:00:00.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config/h8300/extfloatlib.c 2003-10-10 02:14:45.000000000 +0900 @@ -0,0 +1,11 @@ +/* from /gcc/config/m68k/fpgnulib.c */ + +/* convert float to int */ +long +__fixdfsi (double a1); +int +__fixsfsi (float a1) +{ + double foo = a1; + return __fixdfsi (foo); +} diff -Nru gcc-3.2.1/gcc/config/h8300/h8300.c gcc-3.2.1-h8300/gcc/config/h8300/h8300.c --- gcc-3.2.1/gcc/config/h8300/h8300.c 2002-02-23 23:17:25.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config/h8300/h8300.c 2003-10-10 02:14:45.000000000 +0900 @@ -1393,6 +1393,8 @@ if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM) offset += UNITS_PER_WORD; /* Skip saved PC */ } + if ((TARGET_H8300H || TARGET_H8300S) && TARGET_MODE) + offset -= 2; return offset; } diff -Nru gcc-3.2.1/gcc/config/h8300/h8300.h gcc-3.2.1-h8300/gcc/config/h8300/h8300.h --- gcc-3.2.1/gcc/config/h8300/h8300.h 2002-05-22 08:44:58.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config/h8300/h8300.h 2003-10-10 02:14:45.000000000 +0900 @@ -38,9 +38,12 @@ extern const char * const *h8_reg_names; /* Names to predefine in the preprocessor for this target machine. */ - +/* #define CPP_PREDEFINES \ "-D__LONG_MAX__=2147483647L -D__LONG_LONG_MAX__=2147483647L" +*/ +#define CPP_PREDEFINES \ +"-D__LONG_MAX__=2147483647L" #define CPP_SPEC \ "%{!mh:%{!ms:-D__H8300__}} %{mh:-D__H8300H__} %{ms:-D__H8300S__} \ @@ -51,6 +54,7 @@ %{mh:-Acpu=h8300h -Amachine=h8300h} \ %{ms:-Acpu=h8300s -Amachine=h8300s} \ %{!mint32:-D__INT_MAX__=32767} %{mint32:-D__INT_MAX__=2147483647} \ + %{!mint32:-D__LONG_LONG_MAX__=2147483647L} %{mint32:-D__LONG_LONG_MAX__=9223372036854775807LL} \ %(subtarget_cpp_spec)" #define SUBTARGET_CPP_SPEC "" @@ -107,6 +111,8 @@ alignment. */ #define TARGET_ALIGN_300 (target_flags & 8192) +#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 } @@ -131,6 +137,7 @@ {"h", 4096, N_("Generate H8/300H code")}, \ {"no-h", -4096, N_("Do not generate H8/300H code")}, \ {"align-300", 8192, N_("Use H8/300 alignment rules")}, \ + {"n", 16384, N_("Normal Mode Stackframe")}, \ { "", TARGET_DEFAULT, NULL}} #ifdef IN_LIBGCC2 @@ -220,9 +227,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 @@ -1337,4 +1344,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 gcc-3.2.1/gcc/config/h8300/t-h8300 gcc-3.2.1-h8300/gcc/config/h8300/t-h8300 --- gcc-3.2.1/gcc/config/h8300/t-h8300 2001-08-31 02:51:04.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config/h8300/t-h8300 2003-10-10 02:37:29.000000000 +0900 @@ -5,18 +5,16 @@ LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \ _floatdisf _fixsfdi _fixunssfdi _fixunssfsi_asm -LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c +LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c $(srcdir)/floatlib.c $(srcdir)/config/h8300/extfloatlib.c -# We do not have DF or DI types, so fake out the libgcc2 compilation. -TARGET_LIBGCC2_CFLAGS = -DDF=SF -DDI=SI # 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 fp-bit.c: $(srcdir)/config/fp-bit.c echo '#define FLOAT' > fp-bit.c - echo '#define FLOAT_ONLY' >> fp-bit.c echo '#define SMALL_MACHINE' >> fp-bit.c echo '#ifdef __H8300__' >> fp-bit.c echo '#define CMPtype HItype' >> fp-bit.c @@ -25,8 +23,17 @@ echo '#endif' >> fp-bit.c cat $(srcdir)/config/fp-bit.c >> fp-bit.c -MULTILIB_OPTIONS = mh/ms mint32 -MULTILIB_DIRNAMES = h8300h h8300s int32 +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 + cat $(srcdir)/config/fp-bit.c >> dp-bit.c + +MULTILIB_OPTIONS = mh/ms mn mint32 +MULTILIB_DIRNAMES = h8300h h8300s normal int32 MULTILIB_EXCEPTIONS = mint32 LIBGCC = stmp-multilib diff -Nru gcc-3.2.1/gcc/config.gcc gcc-3.2.1-h8300/gcc/config.gcc --- gcc-3.2.1/gcc/config.gcc 2002-10-24 02:28:29.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/config.gcc 2003-10-10 02:14:45.000000000 +0900 @@ -859,7 +859,7 @@ h8300-*-elf*) tmake_file="h8300/t-h8300 h8300/t-elf" tm_file="h8300/h8300.h h8300/elf.h" - float_format=i32 + float_format=h8300 ;; h8300-*-*) float_format=i32 diff -Nru gcc-3.2.1/gcc/floatlib.c gcc-3.2.1-h8300/gcc/floatlib.c --- gcc-3.2.1/gcc/floatlib.c 2001-10-11 12:15:38.000000000 +0900 +++ gcc-3.2.1-h8300/gcc/floatlib.c 2003-10-10 02:14:45.000000000 +0900 @@ -430,13 +430,13 @@ float __floatsisf (long a1) { - (float)__floatsidf(a1); + return (float)__floatsidf(a1); } float __floatdisf (long long a1) { - (float)__floatdidf(a1); + return (float)__floatdidf(a1); } /* negate a float */