From 4a5eab38a41b2750c849bcf504e6e21cce281be1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 16 Mar 2004 20:37:31 +0000 Subject: c-common.c (c_common_type_for_mode): Build vector types on demand. gcc/ChangeLog 2004-03-16 Paolo Bonzini * c-common.c (c_common_type_for_mode): Build vector types on demand. (handle_mode_attribute): Deprecate using the mode attribute to create vector types. Fix indentation. (vector_type_node_list): Remove. (handle_vector_size_attribute): Create vector types on demand. Strip a NON_LVALUE_EXPR from the attribute if there is one. * c-typeck.c (comptypes): Make vector types compatible if they have the same underlying mode. (convert_for_assignment): Use comptypes to convert between vector types. * tree.c (build_common_tree_nodes_2): Do not create vector types. * config/arm/arm.c (arm_init_iwmmxt_builtins): Create necessary vector types. * tree.h: Remove vector types. * config/i386/i386.c (i386_init_mmx_sse_builtins): Likewise. * config/rs6000/rs6000.c (rs6000_init_builtins): Likewise. (V16QI_type_node, V2SI_type_node, V2SF_type_node, V4HI_type_node, V4SI_type_node, V4SF_type_node, V8HI_type_node): New globals. * doc/extend.texi (Vector Types): Document how to use the vector_size attribute to create vectors, rather than mode. * config/arm/mmintrin.h: Use vector_size attribute, not mode. * config/i386/emmintrin.h: Likewise. * config/i386/mmintrin.h: Likewise. * config/i386/xmmintrin.h: Likewise. * config/sh/ushmedia.h: Likwise. testsuite/ChangeLog 2004-03-16 Paolo Bonzini * g++.dg/eh/simd-1.C: Use vector_size attribute, not mode. * g++.dg/eh/simd-2.C: Likewise. * g++.dg/init/array10.C: Likewise. * gcc.c-torture/compile/simd-1.c: Likewise. * gcc.c-torture/compile/simd-2.c: Likewise. * gcc.c-torture/compile/simd-3.c: Likewise. * gcc.c-torture/compile/simd-4.c: Likewise. * gcc.c-torture/compile/simd-6.c: Likewise. * gcc.c-torture/execute/simd-1.c: Likewise. * gcc.c-torture/execute/simd-2.c: Likewise. * gcc.dg/compat/vector-defs.h: Likewise. * gcc.dg/20020531-1.c: Likewise. * gcc.dg/altivec-3.c: Likewise. * gcc.dg/altivec-4.c: Likewise. * gcc.dg/altivec-varargs-1.c: Likewise. * testsuite/gcc.dg/compat/vector-defs.h: Likewise. * gcc.dg/i386-mmx-3.c: Likewise. * gcc.dg/i386-sse-4.c: Likewise. * gcc.dg/i386-sse-5.c: Likewise. * gcc.dg/i386-sse-8.c: Likewise. * gcc.dg/simd-1.c: Likewise. * gcc.dg/20030218-1.c: Likewise. Plus, do not declare __ev64_opaque__ since the machine description provides it. Index: c-common.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/c-common.c,v retrieving revision 1.487 diff -u -r1.487 c-common.c --- c-common.c 26 Feb 2004 01:24:37 -0000 1.487 +++ c-common.c 10 Mar 2004 10:25:28 -0000 @@ -1874,38 +1874,12 @@ if (mode == TYPE_MODE (build_pointer_type (integer_type_node))) return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode); - switch (mode) + if (VECTOR_MODE_P (mode)) { - case V16QImode: From-SVN: r79544 --- gcc/doc/extend.texi | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'gcc/doc/extend.texi') diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 79b0a88..05c7797 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -4631,30 +4631,24 @@ The first step in using these extensions is to provide the necessary data types. This should be done using an appropriate @code{typedef}: @smallexample -typedef int v4si __attribute__ ((mode(V4SI))); +typedef int v4si __attribute__ ((vector_size (16))); @end smallexample -The base type @code{int} is effectively ignored by the compiler, the -actual properties of the new type @code{v4si} are defined by the -@code{__attribute__}. It defines the machine mode to be used; for vector -types these have the form @code{V@var{n}@var{B}}; @var{n} should be the -number of elements in the vector, and @var{B} should be the base mode of the -individual elements. The following can be used as base modes: +The @code{int} type specifies the base type, while the attribute specifies +the vector size for the variable, measured in bytes. For example, the +declaration above causes the compiler to set the mode for the @code{v4si} +type to be 16 bytes wide and divided into @code{int} sized units. For +a 32-bit @code{int} this means a vector of 4 units of 4 bytes, and the +corresponding mode of @code{foo} will be @acronym{V4SI}. -@table @code -@item QI -An integer that is as wide as the smallest addressable unit, usually 8 bits. -@item HI -An integer, twice as wide as a QI mode integer, usually 16 bits. -@item SI -An integer, four times as wide as a QI mode integer, usually 32 bits. -@item DI -An integer, eight times as wide as a QI mode integer, usually 64 bits. -@item SF -A floating point value, as wide as a SI mode integer, usually 32 bits. -@item DF -A floating point value, as wide as a DI mode integer, usually 64 bits. -@end table +The @code{vector_size} attribute is only applicable to integral and +float scalars, although arrays, pointers, and function return values +are allowed in conjunction with this construct. + +All the basic integer types can be used as base types, both as signed +and as unsigned: @code{char}, @code{short}, @code{int}, @code{long}, +@code{long long}. In addition, @code{float} and @code{double} can be +used to build floating-point vector types. Specifying a combination that is not valid for the current architecture will cause GCC to synthesize the instructions using a narrower mode. @@ -4673,7 +4667,7 @@ added to the corresponding 4 elements in @var{b} and the resulting vector will be stored in @var{c}. @smallexample -typedef int v4si __attribute__ ((mode(V4SI))); +typedef int v4si __attribute__ ((vector_size (16))); v4si a, b, c; -- cgit v1.1