diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2004-03-16 20:37:31 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gcc.gnu.org> | 2004-03-16 20:37:31 +0000 |
commit | 4a5eab38a41b2750c849bcf504e6e21cce281be1 (patch) | |
tree | 05a7ca68f6fe2a4b712b3767d14e66338ca08ba6 /gcc/tree.c | |
parent | 7de53bcaa3ef7dadb3b2b151e3c416c7713f159e (diff) | |
download | gcc-4a5eab38a41b2750c849bcf504e6e21cce281be1.zip gcc-4a5eab38a41b2750c849bcf504e6e21cce281be1.tar.gz gcc-4a5eab38a41b2750c849bcf504e6e21cce281be1.tar.bz2 |
c-common.c (c_common_type_for_mode): Build vector types on demand.
gcc/ChangeLog
2004-03-16 Paolo Bonzini <bonzini@gnu.org>
* 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 <bonzini@gnu.org>
* 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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 65 |
1 files changed, 23 insertions, 42 deletions
@@ -5115,40 +5115,6 @@ build_common_tree_nodes_2 (int short_double) va_list_type_node = t; } - - unsigned_V4SI_type_node - = make_vector (V4SImode, unsigned_intSI_type_node, 1); - unsigned_V2HI_type_node - = make_vector (V2HImode, unsigned_intHI_type_node, 1); - unsigned_V2SI_type_node - = make_vector (V2SImode, unsigned_intSI_type_node, 1); - unsigned_V2DI_type_node - = make_vector (V2DImode, unsigned_intDI_type_node, 1); - unsigned_V4HI_type_node - = make_vector (V4HImode, unsigned_intHI_type_node, 1); - unsigned_V8QI_type_node - = make_vector (V8QImode, unsigned_intQI_type_node, 1); - unsigned_V8HI_type_node - = make_vector (V8HImode, unsigned_intHI_type_node, 1); - unsigned_V16QI_type_node - = make_vector (V16QImode, unsigned_intQI_type_node, 1); - unsigned_V1DI_type_node - = make_vector (V1DImode, unsigned_intDI_type_node, 1); - - V16SF_type_node = make_vector (V16SFmode, float_type_node, 0); - V4SF_type_node = make_vector (V4SFmode, float_type_node, 0); - V4SI_type_node = make_vector (V4SImode, intSI_type_node, 0); - V2HI_type_node = make_vector (V2HImode, intHI_type_node, 0); - V2SI_type_node = make_vector (V2SImode, intSI_type_node, 0); - V2DI_type_node = make_vector (V2DImode, intDI_type_node, 0); - V4HI_type_node = make_vector (V4HImode, intHI_type_node, 0); - V8QI_type_node = make_vector (V8QImode, intQI_type_node, 0); - V8HI_type_node = make_vector (V8HImode, intHI_type_node, 0); - V2SF_type_node = make_vector (V2SFmode, float_type_node, 0); - V2DF_type_node = make_vector (V2DFmode, double_type_node, 0); - V16QI_type_node = make_vector (V16QImode, intQI_type_node, 0); - V1DI_type_node = make_vector (V1DImode, intDI_type_node, 0); - V4DF_type_node = make_vector (V4DFmode, double_type_node, 0); } /* HACK. GROSS. This is absolutely disgusting. I wish there was a @@ -5197,26 +5163,41 @@ reconstruct_complex_type (tree type, tree bottom) return outer; } -/* Returns a vector tree node given a vector mode, the inner type, and - the signness. */ - +/* Returns a vector tree node given a vector mode and inner type. */ tree -make_vector (enum machine_mode mode, tree innertype, int unsignedp) +build_vector_type_for_mode (tree innertype, enum machine_mode mode) { tree t; - t = make_node (VECTOR_TYPE); TREE_TYPE (t) = innertype; TYPE_MODE (t) = mode; - TREE_UNSIGNED (TREE_TYPE (t)) = unsignedp; + TREE_UNSIGNED (t) = TREE_UNSIGNED (innertype); finish_vector_type (t); - return t; } +/* Similarly, but takes inner type and units. */ + +tree +build_vector_type (tree innertype, int nunits) +{ + enum machine_mode innermode = TYPE_MODE (innertype); + enum machine_mode mode; + + if (GET_MODE_CLASS (innermode) == MODE_FLOAT) + mode = MIN_MODE_VECTOR_FLOAT; + else + mode = MIN_MODE_VECTOR_INT; + + for (; mode != VOIDmode ; mode = GET_MODE_WIDER_MODE (mode)) + if (GET_MODE_NUNITS (mode) == nunits && GET_MODE_INNER (mode) == innermode) + return build_vector_type_for_mode (innertype, mode); + + return NULL_TREE; +} + /* Given an initializer INIT, return TRUE if INIT is zero or some aggregate of zeros. Otherwise return FALSE. */ - bool initializer_zerop (tree init) { |