From 99fa8911490c35ac4ebf39dfdba2783f49e45fca Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 31 Aug 2004 00:29:04 +0000 Subject: [PATCH] re PR rtl-optimization/13987 (compile time regression while compile fold-const.i) 2004-08-30 Andrew Pinski PR rtl-opt/13987 * config.host (use_long_long_for_widest_fast_int): New, default is off. (ia64-*-hpux*): Enable use_long_long_for_widest_fast_int. * configure.ac: If use_long_long_for_widest_fast_int, then define USE_LONG_LONG_FOR_WIDEST_FAST_INT. * configure: Regenerate. * config.in: Regenerate. * hwint.h (HOST_WIDEST_FAST_INT, HOST_BITS_PER_WIDEST_FAST_INT): New: widest integer type supported efficiently in hardware for the host. * sbitmap.h (SBITMAP_ELT_BITS): Define based on HOST_BITS_PER_WIDEST_FAST_INT. (SBITMAP_ELT_TYPE): Define based on HOST_WIDEST_FAST_INT. * hard-reg-set.h (HARD_REG_ELT_TYPE): Define based on HOST_WIDEST_FAST_INT instead of HOST_WIDE_INT. (HARD_REG_SET_LONGS): Likewise. (UHOST_BITS_PER_WIDE_INT): Likewise. Change the checks for the fast cases to be based on HOST_BITS_PER_WIDES_FAST_INT instead of HOST_BITS_PER_WIDE_INT. From-SVN: r86816 --- gcc/ChangeLog | 24 ++++++++++++++++++++++++ gcc/config.host | 8 ++++++++ gcc/config.in | 4 ++++ gcc/configure | 8 ++++++++ gcc/configure.ac | 6 ++++++ gcc/hard-reg-set.h | 27 ++++++++++++++------------- gcc/hwint.h | 23 +++++++++++++++++++++++ gcc/sbitmap.h | 4 ++-- 8 files changed, 89 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce84375fcf1..e5c7ac0a3bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2004-08-30 Andrew Pinski + + PR rtl-opt/13987 + * config.host (use_long_long_for_widest_fast_int): New, default is + off. + (ia64-*-hpux*): Enable use_long_long_for_widest_fast_int. + * configure.ac: If use_long_long_for_widest_fast_int, then + define USE_LONG_LONG_FOR_WIDEST_FAST_INT. + * configure: Regenerate. + * config.in: Regenerate. + * hwint.h (HOST_WIDEST_FAST_INT, HOST_BITS_PER_WIDEST_FAST_INT): + New: widest integer type supported efficiently in hardware for the + host. + * sbitmap.h (SBITMAP_ELT_BITS): Define based on + HOST_BITS_PER_WIDEST_FAST_INT. + (SBITMAP_ELT_TYPE): Define based on HOST_WIDEST_FAST_INT. + * hard-reg-set.h (HARD_REG_ELT_TYPE): Define based on + HOST_WIDEST_FAST_INT + instead of HOST_WIDE_INT. + (HARD_REG_SET_LONGS): Likewise. + (UHOST_BITS_PER_WIDE_INT): Likewise. + Change the checks for the fast cases to be based on + HOST_BITS_PER_WIDES_FAST_INT instead of HOST_BITS_PER_WIDE_INT. + 2004-08-30 Steven Bosscher * cfgcleanup.c (merge_memattrs): Look at the value of MEM_SIZE, diff --git a/gcc/config.host b/gcc/config.host index 67a067c169f..fa7963062bf 100644 --- a/gcc/config.host +++ b/gcc/config.host @@ -52,6 +52,10 @@ # # host_can_use_collect2 Set to yes normally; to no if the host cannot # link or otherwise use collect2 +# use_long_long_for_widest_fast_int Set this to 'yes' if 'long long' +# (or '__int64') is wider than 'long' but still +# efficeiently supported by the host hardware. +# Only affects compile speed. Default is 'no'. # When setting any of these variables, check to see if a corresponding # variable is present in config.build; if so, you will likely want to @@ -66,6 +70,7 @@ host_extra_objs= host_extra_gcc_objs= out_host_hook_obj=host-default.o host_can_use_collect2=yes +use_long_long_for_widest_fast_int=no # Unsupported hosts list. Generally, only include hosts known to fail here, # since we allow hosts not listed to be supported generically. @@ -172,4 +177,7 @@ case ${host} in out_host_hook_obj=host-linux.o host_xmake_file=x-linux ;; + ia64-*-hpux*) + use_long_long_for_widest_fast_int=yes + ;; esac diff --git a/gcc/config.in b/gcc/config.in index a104c6739c3..f169e6dfdb1 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -576,6 +576,10 @@ /* Define if gcc should use -lunwind. */ #undef USE_LIBUNWIND_EXCEPTIONS +/* Define to 1 if the 'long long' (or '__int64') is wider than 'long' but + still efficiently supported by the host hardware. */ +#undef USE_LONG_LONG_FOR_WIDEST_FAST_INT + /* Define if location_t is fileline integer cookie. */ #undef USE_MAPPED_LOCATION diff --git a/gcc/configure b/gcc/configure index 50faa15f998..db6fc03cb54 100755 --- a/gcc/configure +++ b/gcc/configure @@ -9281,6 +9281,14 @@ _ACEOF fi +if test x$use_long_long_for_widest_fast_int = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define USE_LONG_LONG_FOR_WIDEST_FAST_INT 1 +_ACEOF + +fi + count=a for f in $host_xm_file; do count=${count}x diff --git a/gcc/configure.ac b/gcc/configure.ac index 18c0d1f179f..f1295d4f4d6 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1220,6 +1220,12 @@ if test x$need_64bit_hwint = xyes; then [Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h).]) fi +if test x$use_long_long_for_widest_fast_int = xyes; then + AC_DEFINE(USE_LONG_LONG_FOR_WIDEST_FAST_INT, 1, +[Define to 1 if the 'long long' (or '__int64') is wider than 'long' but still +efficiently supported by the host hardware.]) +fi + count=a for f in $host_xm_file; do count=${count}x diff --git a/gcc/hard-reg-set.h b/gcc/hard-reg-set.h index a770180e386..166a839a759 100644 --- a/gcc/hard-reg-set.h +++ b/gcc/hard-reg-set.h @@ -33,22 +33,23 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA Note that lots of code assumes that the first part of a regset is the same format as a HARD_REG_SET. To help make sure this is true, - we only try the widest integer mode (HOST_WIDE_INT) instead of all the - smaller types. This approach loses only if there are a very few - registers and then only in the few cases where we have an array of - HARD_REG_SETs, so it needn't be as complex as it used to be. */ + we only try the widest fast integer mode (HOST_WIDEST_FAST_INT) + instead of all the smaller types. This approach loses only if + there are avery few registers and then only in the few cases where + we have an array of HARD_REG_SETs, so it needn't be as complex as + it used to be. */ -typedef unsigned HOST_WIDE_INT HARD_REG_ELT_TYPE; +typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE; -#if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDE_INT +#if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT #define HARD_REG_SET HARD_REG_ELT_TYPE #else #define HARD_REG_SET_LONGS \ - ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDE_INT - 1) \ - / HOST_BITS_PER_WIDE_INT) + ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1) \ + / HOST_BITS_PER_WIDEST_FAST_INT) typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS]; #endif @@ -111,7 +112,7 @@ typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS]; #else -#define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDE_INT) +#define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT) #define SET_HARD_REG_BIT(SET, BIT) \ ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ @@ -125,7 +126,7 @@ typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS]; (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))) -#if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDE_INT +#if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT #define CLEAR_HARD_REG_SET(TO) \ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ scan_tp_[0] = 0; \ @@ -179,7 +180,7 @@ do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \ goto TO; } while (0) #else -#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDE_INT +#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDES_FAST_INT #define CLEAR_HARD_REG_SET(TO) \ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ scan_tp_[0] = 0; \ @@ -243,7 +244,7 @@ do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \ goto TO; } while (0) #else -#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDE_INT +#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT #define CLEAR_HARD_REG_SET(TO) \ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ scan_tp_[0] = 0; \ @@ -316,7 +317,7 @@ do { HARD_REG_ELT_TYPE *scan_xp_ = (X), *scan_yp_ = (Y); \ && (scan_xp_[3] == scan_yp_[3])) \ goto TO; } while (0) -#else /* FIRST_PSEUDO_REGISTER > 3*HOST_BITS_PER_WIDE_INT */ +#else /* FIRST_PSEUDO_REGISTER > 3*HOST_BITS_PER_WIDEST_FAST_INT */ #define CLEAR_HARD_REG_SET(TO) \ do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ diff --git a/gcc/hwint.h b/gcc/hwint.h index 4fed004cbf6..ccf624f6d05 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -116,4 +116,27 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1]; # define HOST_WIDEST_INT_PRINT_DOUBLE_HEX "0x%llx%016llx" #endif +/* Define HOST_WIDEST_FAST_INT to the widest integer type supported + efficiently in hardware. (That is, the widest integer type that fits + in a hardware register.) Normally this is "long" but on some hosts it + should be "long long" or "__int64". This is no convenient way to + autodect this, so such systems must set a flag in config.host; see there + for details. */ + +#ifdef USE_LONG_LONG_FOR_WIDEST_FAST_INT +# ifdef HAVE_LONG_LONG +# define HOST_WIDEST_FAST_INT long long +# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONGLONG +# elif defined (HAVE___INT64) +# define HOST_WIDEST_FAST_INT __int64 +# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER___INT64 +# else +# error "Your host said it wantted to use long long or __int64 but neither" +# error "exist" +# endif +#else +# define HOST_WIDEST_FAST_INT long +# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONG +#endif + #endif /* ! GCC_HWINT_H */ diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h index 0ddc0d051c6..8584811cddb 100644 --- a/gcc/sbitmap.h +++ b/gcc/sbitmap.h @@ -25,8 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA It should be straightforward to convert so for now we keep things simple while more important issues are dealt with. */ -#define SBITMAP_ELT_BITS ((unsigned) HOST_BITS_PER_WIDE_INT) -#define SBITMAP_ELT_TYPE unsigned HOST_WIDE_INT +#define SBITMAP_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT) +#define SBITMAP_ELT_TYPE unsigned HOST_WIDEST_FAST_INT typedef struct simple_bitmap_def {