More SSE infrastructure

Bernd Schmidt bernds@masala.cygnus.co.uk
Mon Jul 3 11:08:00 GMT 2000


There are two parts in this patch.  The first one adds a new target macro,
MAX_INTEGER_COMPUTATION_OK, which can be used to allow exceptions from
the "no expressions wider than MAX_INTEGER_COMPUTATION_MODE allowed" rule.
It's used by the i386 backend to allow some 128 bit wide expressions for
SSE.

The other one adds code to force HOST_WIDE_INT to long long if possible for
i386 targets.  (This differs a bit from the code in the Redhat tree which
doesn't work with compilers that don't support long long).
I'd really like to avoid this part; it makes the compiler use more memory
and makes it slower, and it is only used rarely: since we don't deal with
TImode constants or anything in the SSE implementation, the only place in
the compiler I've found so far that relies on it is debugging output (where
TImode constants are used for TYPE_{MIN,MAX}_VALUE of 128 bit integers.
Unfortunately, I don't see a good solution other than this patch.

A bootstrap on i586-linux is running now (almost completed).

Bernd

        * configure.in: Test whether host compiler accepts long long integers.
	For ix86 targets, try to provide 64 bit HOST_WIDE_INT.
	* configure: Rebuilt.
	* config/host_wint.h: New file.
	* config/i386/i386.c (override_options): If HOST_WIDE_INT is not long
	long, disable SSE support.

	* tm.texi (MAX_INTEGER_COMPUTATION_OK): Document.
	(MD_EXPAND_BUILTIN): Document.
	(MD_INIT_BUILTINS): Document.
	* expr.c (MAX_INTEGER_COMPUTATION_OK): Provide default.
	(check_max_integer_computation_mode): Use it.
	(expand_expr): Likewise.
	* config/i386/i386.h (MAX_INTEGER_COMPUTATION_OK): New macro.
	(MAX_INTEGER_COMPUTATION_MODE): New macro.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.394
diff -c -p -r1.394 configure.in
*** configure.in	2000/06/21 00:27:53	1.394
--- configure.in	2000/07/03 17:06:37
*************** AC_SUBST(NO_MINUS_C_MINUS_O)
*** 332,337 ****
--- 332,348 ----
  
  gcc_AC_C_LONG_DOUBLE
  
+ AC_MSG_CHECKING(whether ${CC-cc} accepts long long integers)
+ echo 'void f(){ long long x = 8ll; }' > conftest.c
+ if test -z "`${CC-cc} -c conftest.c 2>&1`"; then
+   ac_cv_prog_cc_long_long_ints=yes
+ else
+   ac_cv_prog_cc_long_long_ints=no
+ fi
+ rm -f conftest*
+ echo "$ac_t"$ac_cv_prog_cc_long_long_ints 1>&6
+ 
+ 
  AC_MSG_CHECKING(whether ${CC-cc} accepts -Wno-long-long)
  echo 'void f(){}' > conftest.c
  if test -z "`${CC-cc} -Wno-long-long -c conftest.c 2>&1`"; then
*************** changequote([,])dnl
*** 3702,3707 ****
--- 3713,3725 ----
  	# Process --with-cpu= for PowerPC/rs6000
  	target_cpu_default2=
  	case $machine in
+ 	i[[34567]]86-*-*)
+  		if [[ $machine = $target ]]; then
+  			target_requires_64bit_host_wide_int=yes
+  		fi
+ 		;;
+ 	esac
+ 	case $machine in
  	i486-*-*)
  		target_cpu_default2=1
  		;;
*************** else
*** 4027,4032 ****
--- 4046,4066 ----
  	cd ..
  	rm -rf $tempdir
  	build_xm_file="auto-build.h gansidecl.h ${build_xm_file} hwint.h"
+ fi
+ 
+ if [[ x$target_requires_64bit_host_wide_int = xyes ]]; then
+ 	if [[ "x$ac_cv_prog_cc_long_long_ints" = "xyes" ]]; then
+ 		# If host == build, then we build only a single binary
+ 		# for rtl.o and other files.  Thus we must be consistent
+ 		# with the defintion of HOST_WIDE_INT between the build
+ 		# and host, so include host_wint.h in the build.h file too
+ 		if [[ "$host_xm_file" = "$build_xm_file" ]]; then
+ 			build_xm_file="host_wint.h ${build_xm_file}"
+ 			host_xm_file="host_wint.h ${host_xm_file} "
+ 		else
+ 			host_xm_file="host_wint.h ${host_xm_file}"
+ 		fi
+ 	fi
  fi
  
  xm_file="gansidecl.h ${xm_file}"
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.247
diff -c -p -r1.247 expr.c
*** expr.c	2000/06/24 19:26:42	1.247
--- expr.c	2000/07/03 17:06:48
*************** Boston, MA 02111-1307, USA.  */
*** 86,91 ****
--- 86,95 ----
  #define CASE_VECTOR_PC_RELATIVE 0
  #endif
  
+ #ifndef MAX_INTEGER_COMPUTATION_OK
+ #define MAX_INTEGER_COMPUTATION_OK(EXP) 0
+ #endif
+ 
  /* If this is nonzero, we do not bother generating VOLATILE
     around volatile memory references, and we are willing to
     output indirect addresses.  If cse is to follow, we reject
*************** check_max_integer_computation_mode (exp)
*** 5665,5670 ****
--- 5669,5675 ----
      {
        mode = TYPE_MODE (TREE_TYPE (exp));
        if (GET_MODE_CLASS (mode) == MODE_INT
+ 	  && ! MAX_INTEGER_COMPUTATION_OK (exp)
  	  && mode > MAX_INTEGER_COMPUTATION_MODE)
  	fatal ("unsupported wide integer operation");
      }
*************** check_max_integer_computation_mode (exp)
*** 5674,5679 ****
--- 5679,5685 ----
      {
        mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
        if (GET_MODE_CLASS (mode) == MODE_INT
+ 	  && ! MAX_INTEGER_COMPUTATION_OK (exp)
  	  && mode > MAX_INTEGER_COMPUTATION_MODE)
  	fatal ("unsupported wide integer operation");
      }
*************** check_max_integer_computation_mode (exp)
*** 5683,5693 ****
--- 5689,5701 ----
      {
        mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
        if (GET_MODE_CLASS (mode) == MODE_INT
+ 	  && ! MAX_INTEGER_COMPUTATION_OK (exp)
  	  && mode > MAX_INTEGER_COMPUTATION_MODE)
  	fatal ("unsupported wide integer operation");
  
        mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
        if (GET_MODE_CLASS (mode) == MODE_INT
+ 	  && ! MAX_INTEGER_COMPUTATION_OK (exp)
  	  && mode > MAX_INTEGER_COMPUTATION_MODE)
  	fatal ("unsupported wide integer operation");
      }
*************** expand_expr (exp, target, tmode, modifie
*** 5867,5872 ****
--- 5875,5881 ----
        enum machine_mode mode = GET_MODE (target);
  
        if (GET_MODE_CLASS (mode) == MODE_INT
+ 	  && ! MAX_INTEGER_COMPUTATION_OK (exp)
  	  && mode > MAX_INTEGER_COMPUTATION_MODE)
  	fatal ("unsupported wide integer operation");
      }
*************** expand_expr (exp, target, tmode, modifie
*** 5882,5887 ****
--- 5891,5897 ----
        && TREE_CODE (exp) != CALL_EXPR
        && TREE_CODE (exp) != RTL_EXPR
        && GET_MODE_CLASS (tmode) == MODE_INT
+       && ! MAX_INTEGER_COMPUTATION_OK (exp)
        && tmode > MAX_INTEGER_COMPUTATION_MODE)
      fatal ("unsupported wide integer operation");
  
Index: tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.131
diff -c -p -r1.131 tm.texi
*** tm.texi	2000/06/25 17:27:28	1.131
--- tm.texi	2000/07/03 17:07:01
*************** You need only define this macro if the t
*** 7957,7962 ****
--- 7957,7995 ----
  @code{word_mode} in general purpose registers.  Most targets should not define
  this macro.
  
+ @findex MAX_INTEGER_COMPUTATION_OK
+ @item MAX_INTEGER_COMPUTATION_OK(@var{insn})
+ Define this macro to be nonzero if @samp{MAX_INTEGER_COMPUTATION_MODE}
+ does not allow an expression which is okay for this target.
+ 
+ Most targets defining @samp{MAX_INTEGER_COMPUTATION_MODE} should not
+ define this macro. 
+ 
+ @findex MD_INIT_BUILTINS
+ @item MD_INIT_BUILTINS
+ Define this macro if you have any machine-specific builtin functions that
+ need to be defined.  Machine specific builtins can be useful to expand
+ special machine instructions that would otherwise not normally be generated
+ because they have no equivalent in the source language (for example, SIMD
+ vector instructions or prefetch instructions).
+ 
+ To create a builtin function, call the function @code{builtin_function}
+ which is defined by the language frontend.  You can use any type nodes set
+ up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
+ only language frontends that use these two functions will use
+ @samp{MD_INIT_BUILTINS}.
+ 
+ @findex MD_EXPAND_BUILTIN
+ @item MD_EXPAND_BUILTIN(@var{exp}, @var{target}, @var{subtarget}, @var{mode}, @var{ignore})
+ 
+ Expand a call to a machine specific builtin that was set up by
+ @samp{MD_INIT_BUILTINS}.  @var{exp} is the expression for the function call;
+ the result should go to @var{target} if that is convenient, and have mode
+ @var{mode} if that is convenient.  @var{subtarget} may be used as the target
+ for computing one of @var{exp}'s operands. @var{ignore} is nonzero if the value
+ is to be ignored.
+ This macro should return the result of the call to the builtin.
+ 
  @findex MATH_LIBRARY
  @item MATH_LIBRARY
  Define this macro as a C string constant for the linker argument to link
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.164
diff -c -p -r1.164 i386.c
*** i386.c	2000/06/27 10:24:38	1.164
--- config/i386/i386.c	2000/07/03 17:07:08
*************** override_options ()
*** 634,639 ****
--- 634,644 ----
    if (TARGET_USE_LOOP && optimize)
      flag_branch_on_count_reg = 1;
  
+ #ifndef HAVE_LONG_LONG_HOST_WIDE_INT
+   if (TARGET_SSE)
+     fatal ("SSE is not supported in this build of gcc.");
+ #endif
+ 
    /* It makes no sense to ask for just SSE builtins, so MMX is also turned
       on by -msse.  */
    if (TARGET_SSE)
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.120
diff -c -p -r1.120 i386.h
*** i386.h	2000/06/27 02:26:20	1.120
--- config/i386/i386.h	2000/07/03 17:07:12
*************** extern int ix86_arch;
*** 484,489 ****
--- 484,496 ----
     See also the macro `Pmode' defined below.  */
  #define POINTER_SIZE 32
  
+ #define MAX_INTEGER_COMPUTATION_MODE DImode
+ 
+ /* Value should be nonzero if EXP is okay for MAX_INTEGER_COMPUTATION_MODE */
+ #define MAX_INTEGER_COMPUTATION_OK(EXP) \
+   (TARGET_SSE && \
+    (TREE_CODE (EXP) == NOP_EXPR || TREE_CODE (EXP) == RTL_EXPR))
+ 
  /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
  #define PARM_BOUNDARY 32
  
--- /dev/null	Mon Apr 10 22:28:10 2000
+++ config/host_wint.h	Sun Jul  2 18:22:35 2000
@@ -0,0 +1,6 @@
+#undef HOST_WIDE_INT
+#undef HOST_BITS_PER_WIDE_INT
+#define HOST_WIDE_INT long long
+#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
+
+#define HAVE_LONG_LONG_HOST_WIDE_INT



More information about the Gcc-patches mailing list