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] Fix PR 13987, compile time slow down on powerpc-apple-darwin


When the HOST_WIDE_INT was changed over to 64bit the compile time for
most thing slowed.  GCSE was slower because it would call the functions
in libgcc as sbitmap used HOST_WIDE_INT unconditional even if it is
ineffiecent to use it.  This patch adds a check in config.host for
powerpc and i686 just so they both get the speedup when cross compiling
to targets which need 64bit HOST_WIDE_INT.  Anybody can add their host
to the list if this applies to them, I think sparc and/or mips but I
do not know enough about thier code generation to add them.

This speeds up compiling fold-const.i with -O3 by about 4 seconds
(from 81.8s to 77.9s).

OK? Bootstrapped on powerpc-apple-darwin and i686-pc-linux-gnu with no
regressions.

OK for 3.4 branch also?

Thanks,
Andrew Pinski


ChangeLog:
	* config.host (host_efficient64bit): New, set to yes defaultly.
	Set to no for powerpc-*-* and i686-*-*.
	* configure.ac: If !host_efficient64bit and need_64bit_hwint,
	define HOST_WIDE_INT_NOT_EFFICIENT.
	* configure: Regenerate.
	* config.in: Regenerate.
	* sbitmap.h: Use long instead of HOST_WIDE_INT if
	HOST_WIDE_INT_NOT_EFFICIENT is defined.


Patch:
Index: config.host
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.host,v
retrieving revision 2.10
diff -u -p -r2.10 config.host
--- config.host	5 Jun 2004 07:28:25 -0000	2.10
+++ config.host	8 Jun 2004 03:51:27 -0000
@@ -52,6 +52,8 @@
 #
 #  host_can_use_collect2 Set to yes normally; to no if the host cannot
 #			link or otherwise use collect2
+#  host_efficient64bit Set to yes normally; to no if 64bit integers are
+#			 not as effiecient as 32bit integers
 
 # 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 +68,7 @@ host_extra_objs=
 host_extra_gcc_objs=
 out_host_hook_obj=host-default.o
 host_can_use_collect2=yes
+host_efficient64bit=yes
 
 # Unsupported hosts list.  Generally, only include hosts known to fail here,
 # since we allow hosts not listed to be supported generically.
@@ -80,6 +83,15 @@ case ${host} in
     ;;
 esac
 
+case ${host} in
+  powerpc-*-*)
+    host_efficient64bit=no
+    ;;
+  i?86-*-*)
+    host_efficient64bit=no
+    ;;
+esac
+
 # Machine-specific settings.
 case ${host} in
   alpha*-dec-*vms*)
Index: config.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.in,v
retrieving revision 1.186
diff -u -p -r1.186 config.in
--- config.in	7 Jun 2004 08:17:35 -0000	1.186
+++ config.in	8 Jun 2004 03:51:27 -0000
@@ -475,6 +475,9 @@
 /* Define if your compiler supports the \`__int64' type. */
 #undef HAVE___INT64
 
+/* Define to 1 if HOST_WIDE_INT is not efficient for general use. */
+#undef HOST_WIDE_INT_NOT_EFFICIENT
+
 /* Define if the host machine stores words of multi-word integers in
    big-endian order. */
 #undef HOST_WORDS_BIG_ENDIAN
Index: configure
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure,v
retrieving revision 1.826
diff -u -p -r1.826 configure
--- configure	27 May 2004 19:47:36 -0000	1.826
+++ configure	8 Jun 2004 03:51:28 -0000
@@ -9258,6 +9258,14 @@ _ACEOF
 
 fi
 
+if test x$host_efficient64bit = xno -a x$need_64bit_hwint = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HOST_WIDE_INT_NOT_EFFICIENT 1
+_ACEOF
+
+fi
+
 count=a
 for f in $host_xm_file; do
 	count=${count}x
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.39
diff -u -p -r2.39 configure.ac
--- configure.ac	27 May 2004 19:47:36 -0000	2.39
+++ configure.ac	8 Jun 2004 03:51:28 -0000
@@ -1162,6 +1162,11 @@ 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$host_efficient64bit = xno -a x$need_64bit_hwint = xyes; then
+	AC_DEFINE(HOST_WIDE_INT_NOT_EFFICIENT, 1,
+[Define to 1 if HOST_WIDE_INT is not efficient for general use.])
+fi
+
 count=a
 for f in $host_xm_file; do
 	count=${count}x
Index: sbitmap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sbitmap.h,v
retrieving revision 1.21
diff -u -p -r1.21 sbitmap.h
--- sbitmap.h	13 May 2004 06:39:45 -0000	1.21
+++ sbitmap.h	8 Jun 2004 03:51:29 -0000
@@ -25,8 +25,13 @@ Software Foundation, 59 Temple Place - S
    It should be straightforward to convert so for now we keep things simple
    while more important issues are dealt with.  */
 
+#ifdef HOST_WIDE_INT_NOT_EFFICIENT
+#define SBITMAP_ELT_BITS ((unsigned) HOST_BITS_PER_LONG)
+#define SBITMAP_ELT_TYPE unsigned long
+#else
 #define SBITMAP_ELT_BITS ((unsigned) HOST_BITS_PER_WIDE_INT)
 #define SBITMAP_ELT_TYPE unsigned HOST_WIDE_INT
+#endif
 
 typedef struct simple_bitmap_def
 {


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