aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-generic.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2012-07-10 01:23:39 -0700
committerRichard Henderson <rth@gcc.gnu.org>2012-07-10 01:23:39 -0700
commit3f30a9a6aabcc7408bec1e42736889e3edd9f289 (patch)
tree3004b5ca9b3236230ebbc1657f1529e32ff03d51 /gcc/tree-vect-generic.c
parente53a3e778e70af499292522144fb8d4bea5279cb (diff)
downloadgcc-3f30a9a6aabcc7408bec1e42736889e3edd9f289.zip
gcc-3f30a9a6aabcc7408bec1e42736889e3edd9f289.tar.gz
gcc-3f30a9a6aabcc7408bec1e42736889e3edd9f289.tar.bz2
Add VEC_WIDEN_MULT_EVEN/ODD_EXPR
* tree.def (VEC_WIDEN_MULT_EVEN_EXPR, VEC_WIDEN_MULT_ODD_EXPR): New. * cfgexpand.c (expand_debug_expr): Handle them. * expr.c (expand_expr_real_2): Likewise. * fold-const.c (fold_binary_loc): Likewise. * gimple-pretty-print.c (dump_binary_rhs): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree.c (commutative_tree_code): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. Handle type change before looking up optab. * optabs.h (OTI_vec_widen_umult_even, OTI_vec_widen_umult_odd): New. (OTI_vec_widen_smult_even, OTI_vec_widen_smult_odd): New. (vec_widen_umult_even_optab, vec_widen_umult_odd_optab): New. (vec_widen_smult_even_optab, vec_widen_smult_odd_optab): New. * genopinit.c (optabs): Initialize them. * doc/md.texi: Document them. From-SVN: r189403
Diffstat (limited to 'gcc/tree-vect-generic.c')
-rw-r--r--gcc/tree-vect-generic.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 8d05101..e37c631 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1361,6 +1361,23 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
|| code == VEC_UNPACK_FLOAT_LO_EXPR)
type = TREE_TYPE (rhs1);
+ /* For widening/narrowing vector operations, the relevant type is of the
+ arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is
+ calculated in the same way above. */
+ if (code == WIDEN_SUM_EXPR
+ || code == VEC_WIDEN_MULT_HI_EXPR
+ || code == VEC_WIDEN_MULT_LO_EXPR
+ || code == VEC_WIDEN_MULT_EVEN_EXPR
+ || code == VEC_WIDEN_MULT_ODD_EXPR
+ || code == VEC_UNPACK_HI_EXPR
+ || code == VEC_UNPACK_LO_EXPR
+ || code == VEC_PACK_TRUNC_EXPR
+ || code == VEC_PACK_SAT_EXPR
+ || code == VEC_PACK_FIX_TRUNC_EXPR
+ || code == VEC_WIDEN_LSHIFT_HI_EXPR
+ || code == VEC_WIDEN_LSHIFT_LO_EXPR)
+ type = TREE_TYPE (rhs1);
+
/* Choose between vector shift/rotate by vector and vector shift/rotate by
scalar */
if (code == LSHIFT_EXPR
@@ -1409,21 +1426,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
else
op = optab_for_tree_code (code, type, optab_default);
- /* For widening/narrowing vector operations, the relevant type is of the
- arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is
- calculated in the same way above. */
- if (code == WIDEN_SUM_EXPR
- || code == VEC_WIDEN_MULT_HI_EXPR
- || code == VEC_WIDEN_MULT_LO_EXPR
- || code == VEC_UNPACK_HI_EXPR
- || code == VEC_UNPACK_LO_EXPR
- || code == VEC_PACK_TRUNC_EXPR
- || code == VEC_PACK_SAT_EXPR
- || code == VEC_PACK_FIX_TRUNC_EXPR
- || code == VEC_WIDEN_LSHIFT_HI_EXPR
- || code == VEC_WIDEN_LSHIFT_LO_EXPR)
- type = TREE_TYPE (rhs1);
-
/* 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. */