X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Ftree-vect-generic.c;h=b1e567aa870de2409a44dbbdaa5330e2f14f2f6e;hp=f9c9fda31047271902754e05f3f5fd4585984106;hb=2a1990e9c656063ab626fab258ae2d418378c76d;hpb=c75b4594282e6b33803b8332acba704d057f8d97 diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index f9c9fda3104..b1e567aa870 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1,5 +1,5 @@ /* Lower vector operations to scalar operations. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GCC. @@ -106,13 +106,8 @@ tree_vec_extract (block_stmt_iterator *bsi, tree type, { if (bitpos) return gimplify_build3 (bsi, BIT_FIELD_REF, type, t, bitsize, bitpos); - - /* Build a conversion; VIEW_CONVERT_EXPR is very expensive unless T will - anyway be stored in memory, so prefer NOP_EXPR. */ - else if (TYPE_MODE (type) == BLKmode) - return gimplify_build1 (bsi, VIEW_CONVERT_EXPR, type, t); else - return gimplify_build1 (bsi, NOP_EXPR, type, t); + return gimplify_build1 (bsi, VIEW_CONVERT_EXPR, type, t); } static tree @@ -353,7 +348,7 @@ type_for_widest_vector_mode (enum machine_mode inner_mode, optab op) enum machine_mode best_mode = VOIDmode, mode; int best_nunits = 0; - if (GET_MODE_CLASS (inner_mode) == MODE_FLOAT) + if (SCALAR_FLOAT_MODE_P (inner_mode)) mode = MIN_MODE_VECTOR_FLOAT; else mode = MIN_MODE_VECTOR_INT; @@ -416,6 +411,11 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) gcc_assert (code != CONVERT_EXPR); op = optab_for_tree_code (code, type); + /* For widening vector operations, the relevant type is of the arguments, + not the widened result. */ + if (code == WIDEN_SUM_EXPR) + type = TREE_TYPE (TREE_OPERAND (rhs, 0)); + /* Optabs will try converting a negation into a subtraction, so look for it as well. TODO: negation of floating-point vectors might be turned into an exclusive OR toggling the sign bit. */ @@ -455,16 +455,7 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) if (lang_hooks.types_compatible_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) *p_rhs = rhs; else - { - /* Build a conversion; VIEW_CONVERT_EXPR is very expensive unless T will - be stored in memory anyway, so prefer NOP_EXPR. We should also try - performing the VIEW_CONVERT_EXPR on the left side of the - assignment. */ - if (TYPE_MODE (TREE_TYPE (rhs)) == BLKmode) - *p_rhs = gimplify_build1 (bsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs); - else - *p_rhs = gimplify_build1 (bsi, NOP_EXPR, TREE_TYPE (lhs), rhs); - } + *p_rhs = gimplify_build1 (bsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs); mark_stmt_modified (bsi_stmt (*bsi)); } @@ -478,7 +469,7 @@ gate_expand_vector_operations (void) return flag_tree_vectorize != 0; } -static void +static unsigned int expand_vector_operations (void) { block_stmt_iterator bsi; @@ -492,6 +483,7 @@ expand_vector_operations (void) update_stmt_if_modified (bsi_stmt (bsi)); } } + return 0; } struct tree_opt_pass pass_lower_vector =