aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2006-06-20 15:02:05 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2006-06-20 15:02:05 +0000
commit1000b34d95a6319206389feb136879d42d4675f2 (patch)
treec9dae92eb51b59b6f01612dfb8113ea758cf617a /gcc/expr.c
parentc82f61c591c903d2faab8e9e0257c2fbb004c1fc (diff)
downloadgcc-1000b34d95a6319206389feb136879d42d4675f2.zip
gcc-1000b34d95a6319206389feb136879d42d4675f2.tar.gz
gcc-1000b34d95a6319206389feb136879d42d4675f2.tar.bz2
expr.c (expand_expr_real_1): For vector constants with integer modes...
* 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. From-SVN: r114815
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 94e8586..562588a 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);