diff options
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); |

