This is the mail archive of the gcc@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]

Re: A bit of vector extension documentation


On Thu, 27 Sep 2001, Gerald Pfeifer wrote:

> On Wed, 26 Sep 2001, Bernd Schmidt wrote:
> > Before I check it in - any comments from the regular documentation
> > maintainers?
>
> As far as I can see, this looks fine.

Thanks for looking over it.

> We already have QImode etc. described in rtl.texi; would it make sense
> to unify your descriptions with those resp. add some cross-reference(s)?

I'm not sure about this - do we want to treat the manual as a unit, or do
we want to keep the user and developer parts separated as far as possible?

> + Not all base types or combinations are always valid; which modes can be used
> + is determined by the target machine.  For example, if targetting the i386 MMX
> + extensions, only V8QI, V4HI and V2SI are allowed modes.
>
> Should V8QI etc. become @code{V8QI}?

I suppose they should.

However, I'm still doubtful about exposing a lowlevel interface like
__attribute__((mode)).  So I came up with the patch below, which adds a
new file gcc_vector.h.  This currently provides types for the i386 MMX and
SSE extensions, it can be extended for other CPUs (that's why it's not in
config/i386).

For gcc_vector.h, I copied over the libgcc license - do we have any process
to decide which license to use in cases where the GPL is unlikely to be the
right choice?

I'd like to check in this patch and a modified version of the documentation
patch relatively soon, so if anyone has strong feelings about how we should
expose vector extensions to the user (or about the license issue), please
speak up now.


Bernd

	* config.gcc: For ix86 targets, add gcc_vector.h to extra_headers.
	* config/i386/i386.h (CPP_CPUCOMMON_SPEC): Some new preprocessor
	defines if -mmmx or -msse are enabled.
	* ginclude/gcc_vector.h: New file.

Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config.gcc,v
retrieving revision 1.91
diff -c -p -r1.91 config.gcc
*** config.gcc	2001/09/18 21:51:52	1.91
--- gcc/config.gcc	2001/09/27 14:47:12
*************** case $machine in
*** 3237,3242 ****
--- 3237,3250 ----
  	;;
  esac

+ # Make sure that we provide gcc_vector.h for ix86 systems
+
+ case $machine in
+ i[34567]86-*-*)
+ 	extra_headers=gcc_vector.h
+ 	;;
+ esac
+
  # Distinguish i[34567]86
  # Also, do not run mips-tfile on MIPS if using gas.
  # Process --with-cpu= for PowerPC/rs6000
Index: gcc/config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
retrieving revision 1.204
diff -c -p -r1.204 i386.h
*** i386.h	2001/09/21 12:55:17	1.204
--- gcc/config/i386/i386.h	2001/09/27 14:48:36
*************** extern int ix86_arch;
*** 511,516 ****
--- 511,518 ----
  %{mcpu=k6:-D__tune_k6__ }\
  %{mcpu=athlon:-D__tune_athlon__ }\
  %{mcpu=pentium4:-D__tune_pentium4__ }\
+ %{mmmx:-D__MMX_extensions__ }\
+ %{msse:-D__SSE_extensions__ }\
  %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"

  #ifndef CPP_CPU_SPEC
--- /dev/null	Fri Jan 19 09:35:41 2001
+++ gcc/ginclude/gcc_vector.h	Thu Sep 27 11:25:48 2001
@@ -0,0 +1,38 @@
+/* Define the types used by vector extension.  */
+/* Copyright (C) 2001  Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#ifdef __MMX_extensions__
+typedef int v2si __attribute__((mode(V2SI)));
+typedef int v4hi __attribute__((mode(V4HI)));
+typedef int v8qi __attribute__((mode(V8QI)));
+#endif
+#ifdef __SSE_extensions__
+typedef int v4si __attribute__((mode(V4SI)));
+typedef int v4sf __attribute__((mode(V4SF)));
+#endif



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