diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-20 15:02:05 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-20 15:02:05 +0000 |
commit | 9fd22806c8efa2bfafae3691c43e691b772d9286 (patch) | |
tree | c9dae92eb51b59b6f01612dfb8113ea758cf617a /gcc/expr.c | |
parent | 4eb278908ec332094891617e74647e64ec8cd11b (diff) | |
download | gcc-9fd22806c8efa2bfafae3691c43e691b772d9286.tar.gz |
* expr.c (expand_expr_real_1) <VECTOR_CST>: For vector constants with
integer modes, attempt to directly construct an integer constant.
* fold-const.c (native_encode_vector): Determine the size of each
element from the vector type instead of the first vector element.
* tree.c (build_constructor_single): Mark a CONSTRUCTOR as constant,
if all of its elements/components are constant.
(build_constructor_from_list): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114815 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 94e8586dc35..562588a4481 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6939,14 +6939,21 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return temp; case VECTOR_CST: - if (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (exp))) == MODE_VECTOR_INT - || GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (exp))) == MODE_VECTOR_FLOAT) - return const_vector_from_tree (exp); - else - return expand_expr (build_constructor_from_list - (TREE_TYPE (exp), - TREE_VECTOR_CST_ELTS (exp)), - ignore ? const0_rtx : target, tmode, modifier); + { + tree tmp = NULL_TREE; + if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT + || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) + return const_vector_from_tree (exp); + if (GET_MODE_CLASS (mode) == MODE_INT) + tmp = fold_unary (VIEW_CONVERT_EXPR, + lang_hooks.types.type_for_mode (mode, 1), + exp); + if (!tmp) + tmp = build_constructor_from_list (type, + TREE_VECTOR_CST_ELTS (exp)); + return expand_expr (tmp, ignore ? const0_rtx : target, + tmode, modifier); + } case CONST_DECL: return expand_expr (DECL_INITIAL (exp), target, VOIDmode, modifier); |