diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2001-12-11 19:33:39 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2001-12-11 19:33:39 +0000 |
commit | 0afeef64be52defd45b00c47464183dd43381725 (patch) | |
tree | 84e24cc2300c3468b223984903faa944b7798df6 | |
parent | 3c612a619d0c4476cd0fde1feb1daafddba7c069 (diff) | |
download | gcc-0afeef64be52defd45b00c47464183dd43381725.zip gcc-0afeef64be52defd45b00c47464183dd43381725.tar.gz gcc-0afeef64be52defd45b00c47464183dd43381725.tar.bz2 |
c-common.c (type_for_mode): Handle unsigned vectors.
2001-12-10 Aldy Hernandez <aldyh@redhat.com>
* c-common.c (type_for_mode): Handle unsigned vectors.
(type_for_mode): Remove redundant calls to TYPE_MODE.
* tree.c (make_vector): New.
(build_common_tree_nodes_2): Use make_vector for vector types.
Add unsigned vector types.
* tree.h (tree_index): Add unsigned types for vectors.
(unsigned_V16QI_type_node): New.
(unsigned_V4SI_type_node): New.
(unsigned_V8QI_type_node): New.
(unsigned_V8HI_type_node): New.
(unsigned_V4HI_type_node): New.
(unsigned_V2SI_type_node): New.
From-SVN: r47889
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/c-common.c | 48 | ||||
-rw-r--r-- | gcc/tree.c | 81 | ||||
-rw-r--r-- | gcc/tree.h | 16 |
4 files changed, 103 insertions, 59 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb1fbff..e6a8d64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2001-12-11 Aldy Hernandez <aldyh@redhat.com> + + * c-common.c (type_for_mode): Handle unsigned vectors. + (type_for_mode): Remove redundant calls to TYPE_MODE. + + * tree.c (make_vector): New. + (build_common_tree_nodes_2): Use make_vector for vector types. + Add unsigned vector types. + + * tree.h (tree_index): Add unsigned types for vectors. + (unsigned_V16QI_type_node): New. + (unsigned_V4SI_type_node): New. + (unsigned_V8QI_type_node): New. + (unsigned_V8HI_type_node): New. + (unsigned_V4HI_type_node): New. + (unsigned_V2SI_type_node): New. + 2001-12-11 Stan Shebs <shebs@apple.com> * objc/objc-act.c (finish_message_expr): Fix misplaced parens in a diff --git a/gcc/c-common.c b/gcc/c-common.c index 29bb059..ad58594 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1315,16 +1315,16 @@ type_for_mode (mode, unsignedp) return unsignedp ? widest_unsigned_literal_type_node : widest_integer_literal_type_node; - if (mode == TYPE_MODE (intQI_type_node)) + if (mode == QImode) return unsignedp ? unsigned_intQI_type_node : intQI_type_node; - if (mode == TYPE_MODE (intHI_type_node)) + if (mode == HImode) return unsignedp ? unsigned_intHI_type_node : intHI_type_node; - if (mode == TYPE_MODE (intSI_type_node)) + if (mode == SImode) return unsignedp ? unsigned_intSI_type_node : intSI_type_node; - if (mode == TYPE_MODE (intDI_type_node)) + if (mode == DImode) return unsignedp ? unsigned_intDI_type_node : intDI_type_node; #if HOST_BITS_PER_WIDE_INT >= 64 @@ -1348,22 +1348,30 @@ type_for_mode (mode, unsignedp) return build_pointer_type (integer_type_node); #ifdef VECTOR_MODE_SUPPORTED_P - if (mode == TYPE_MODE (V16QI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V16QI_type_node; - if (mode == TYPE_MODE (V8HI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V8HI_type_node; - if (mode == TYPE_MODE (V4SF_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V4SF_type_node; - if (mode == TYPE_MODE (V4SI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V4SI_type_node; - if (mode == TYPE_MODE (V2SI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V2SI_type_node; - if (mode == TYPE_MODE (V4HI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V4HI_type_node; - if (mode == TYPE_MODE (V8QI_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V8QI_type_node; - if (mode == TYPE_MODE (V2SF_type_node) && VECTOR_MODE_SUPPORTED_P (mode)) - return V2SF_type_node; + if (VECTOR_MODE_SUPPORTED_P (mode)) + { + switch (mode) + { + case V16QImode: + return unsignedp ? unsigned_V16QI_type_node : V16QI_type_node; + case V8HImode: + return unsignedp ? unsigned_V8HI_type_node : V8HI_type_node; + case V4SImode: + return unsignedp ? unsigned_V4SI_type_node : V4SI_type_node; + case V2SImode: + return unsignedp ? unsigned_V2SI_type_node : V2SI_type_node; + case V4HImode: + return unsignedp ? unsigned_V4HI_type_node : V4HI_type_node; + case V8QImode: + return unsignedp ? unsigned_V8QI_type_node : V8QI_type_node; + case V4SFmode: + return V4SF_type_node; + case V2SFmode: + return V2SF_type_node; + default: + break; + } + } #endif return 0; @@ -162,6 +162,7 @@ static int type_hash_eq PARAMS ((const void*, const void*)); static unsigned int type_hash_hash PARAMS ((const void*)); static void print_type_hash_statistics PARAMS((void)); static void finish_vector_type PARAMS((tree)); +static tree make_vector PARAMS ((enum machine_mode, tree, int)); static int type_hash_marked_p PARAMS ((const void *)); static void type_hash_mark PARAMS ((const void *)); static int mark_tree_hashtable_entry PARAMS((void **, void *)); @@ -4874,43 +4875,45 @@ build_common_tree_nodes_2 (short_double) va_list_type_node = t; } - V4SF_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V4SF_type_node) = float_type_node; - TYPE_MODE (V4SF_type_node) = V4SFmode; - finish_vector_type (V4SF_type_node); - - V4SI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V4SI_type_node) = intSI_type_node; - TYPE_MODE (V4SI_type_node) = V4SImode; - finish_vector_type (V4SI_type_node); - - V2SI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V2SI_type_node) = intSI_type_node; - TYPE_MODE (V2SI_type_node) = V2SImode; - finish_vector_type (V2SI_type_node); - - V4HI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V4HI_type_node) = intHI_type_node; - TYPE_MODE (V4HI_type_node) = V4HImode; - finish_vector_type (V4HI_type_node); - - V8QI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V8QI_type_node) = intQI_type_node; - TYPE_MODE (V8QI_type_node) = V8QImode; - finish_vector_type (V8QI_type_node); - - V8HI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V8HI_type_node) = intHI_type_node; - TYPE_MODE (V8HI_type_node) = V8HImode; - finish_vector_type (V8HI_type_node); - - V2SF_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V2SF_type_node) = float_type_node; - TYPE_MODE (V2SF_type_node) = V2SFmode; - finish_vector_type (V2SF_type_node); - - V16QI_type_node = make_node (VECTOR_TYPE); - TREE_TYPE (V16QI_type_node) = intQI_type_node; - TYPE_MODE (V16QI_type_node) = V16QImode; - finish_vector_type (V16QI_type_node); + unsigned_V4SI_type_node + = make_vector (V4SImode, unsigned_intSI_type_node, 1); + unsigned_V2SI_type_node + = make_vector (V2SImode, unsigned_intSI_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); + + V4SF_type_node = make_vector (V4SFmode, float_type_node, 0); + V4SI_type_node = make_vector (V4SImode, intSI_type_node, 0); + V2SI_type_node = make_vector (V2SImode, intSI_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); + V16QI_type_node = make_vector (V16QImode, intQI_type_node, 0); +} + +/* Returns a vector tree node given a vector mode, the inner type, and + the signness. */ + +static tree +make_vector (mode, innertype, unsignedp) + enum machine_mode mode; + tree innertype; + int unsignedp; +{ + tree t; + + t = make_node (VECTOR_TYPE); + TREE_TYPE (t) = innertype; + TYPE_MODE (t) = mode; + TREE_UNSIGNED (TREE_TYPE (t)) = unsignedp; + finish_vector_type (t); + + return t; } @@ -1888,6 +1888,15 @@ enum tree_index TI_VOID_LIST_NODE, + TI_UV4SF_TYPE, + TI_UV4SI_TYPE, + TI_UV8HI_TYPE, + TI_UV8QI_TYPE, + TI_UV4HI_TYPE, + TI_UV2SI_TYPE, + TI_UV2SF_TYPE, + TI_UV16QI_TYPE, + TI_V4SF_TYPE, TI_V4SI_TYPE, TI_V8HI_TYPE, @@ -1956,6 +1965,13 @@ extern tree global_trees[TI_MAX]; #define main_identifier_node global_trees[TI_MAIN_IDENTIFIER] #define MAIN_NAME_P(NODE) (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node) +#define unsigned_V16QI_type_node global_trees[TI_UV16QI_TYPE] +#define unsigned_V4SI_type_node global_trees[TI_UV4SI_TYPE] +#define unsigned_V8QI_type_node global_trees[TI_UV8QI_TYPE] +#define unsigned_V8HI_type_node global_trees[TI_UV8HI_TYPE] +#define unsigned_V4HI_type_node global_trees[TI_UV4HI_TYPE] +#define unsigned_V2SI_type_node global_trees[TI_UV2SI_TYPE] + #define V16QI_type_node global_trees[TI_V16QI_TYPE] #define V4SF_type_node global_trees[TI_V4SF_TYPE] #define V4SI_type_node global_trees[TI_V4SI_TYPE] |