From: Alan Lawrence Date: Tue, 28 Oct 2014 11:17:47 +0000 (+0000) Subject: Remove VEC_LSHIFT_EXPR and vec_shl_optab X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e29dfbf07d93e89e92d8b95bef247fc95a8024ef;p=gcc.git Remove VEC_LSHIFT_EXPR and vec_shl_optab * expr.c (expand_expr_real_2): Remove code handling VEC_LSHIFT_EXPR. * fold-const.c (const_binop): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (expand_vec_shift_expr): Likewise, update comment. * tree.def: Delete VEC_LSHIFT_EXPR, remove comment. * optabs.h (expand_vec_shift_expr): Remove comment re. VEC_LSHIFT_EXPR. * optabs.def: Remove vec_shl_optab. * doc/md.texi: Remove references to vec_shr_m. From-SVN: r216779 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1517a80bac1..536a0007dc0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2014-10-28 Alan Lawrence + + * expr.c (expand_expr_real_2): Remove code handling VEC_LSHIFT_EXPR. + * fold-const.c (const_binop): Likewise. + * cfgexpand.c (expand_debug_expr): Likewise. + * tree-inline.c (estimate_operator_cost): Likewise. + * tree-vect-generic.c (expand_vector_operations_1): Likewise. + * optabs.c (optab_for_tree_code): Likewise. + (expand_vec_shift_expr): Likewise, update comment. + * tree.def: Delete VEC_LSHIFT_EXPR, remove comment. + * optabs.h (expand_vec_shift_expr): Remove comment re. VEC_LSHIFT_EXPR. + * optabs.def: Remove vec_shl_optab. + * doc/md.texi: Remove references to vec_shr_m. + 2014-10-28 Yury Gribov * asan.c (report_error_func): Add noabort path. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 5580ea815cf..e889409c25b 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4598,7 +4598,6 @@ expand_debug_expr (tree exp) case REDUC_MIN_EXPR: case REDUC_PLUS_EXPR: case VEC_COND_EXPR: - case VEC_LSHIFT_EXPR: case VEC_PACK_FIX_TRUNC_EXPR: case VEC_PACK_SAT_EXPR: case VEC_PACK_TRUNC_EXPR: diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 827c8e633d5..3b5511ec39a 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -4796,10 +4796,9 @@ operand 1. Add operand 1 to operand 2 and place the widened result in operand 0. (This is used express accumulation of elements into an accumulator of a wider mode.) -@cindex @code{vec_shl_@var{m}} instruction pattern @cindex @code{vec_shr_@var{m}} instruction pattern -@item @samp{vec_shl_@var{m}}, @samp{vec_shr_@var{m}} -Whole vector left/right shift in bits. +@item @samp{vec_shr_@var{m}} +Whole vector right shift in bits. Operand 1 is a vector to be shifted. Operand 2 is an integer shift amount in bits. Operand 0 is where the resulting shifted vector is stored. diff --git a/gcc/expr.c b/gcc/expr.c index a5bf13a980d..78bdfa24869 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9084,7 +9084,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, return temp; } - case VEC_LSHIFT_EXPR: case VEC_RSHIFT_EXPR: { target = expand_vec_shift_expr (ops, target); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ba9b013db1c..81660706b40 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1415,8 +1415,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2) int count = TYPE_VECTOR_SUBPARTS (type), i; tree *elts = XALLOCAVEC (tree, count); - if (code == VEC_LSHIFT_EXPR - || code == VEC_RSHIFT_EXPR) + if (code == VEC_RSHIFT_EXPR) { if (!tree_fits_uhwi_p (arg2)) return NULL_TREE; @@ -1428,11 +1427,10 @@ const_binop (enum tree_code code, tree arg1, tree arg2) if (shiftc >= outerc || (shiftc % innerc) != 0) return NULL_TREE; int offset = shiftc / innerc; - /* The direction of VEC_[LR]SHIFT_EXPR is endian dependent. - For reductions, compiler emits VEC_RSHIFT_EXPR always, - for !BYTES_BIG_ENDIAN picks first vector element, but - for BYTES_BIG_ENDIAN last element from the vector. */ - if ((code == VEC_RSHIFT_EXPR) ^ (!BYTES_BIG_ENDIAN)) + /* The direction of VEC_RSHIFT_EXPR is endian dependent. + For reductions, if !BYTES_BIG_ENDIAN then compiler picks first + vector element, but last element if BYTES_BIG_ENDIAN. */ + if (BYTES_BIG_ENDIAN) offset = -offset; tree zero = build_zero_cst (TREE_TYPE (type)); for (i = 0; i < count; i++) diff --git a/gcc/optabs.c b/gcc/optabs.c index 677958f0ad9..9452f991a6f 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -519,9 +519,6 @@ optab_for_tree_code (enum tree_code code, const_tree type, case REDUC_PLUS_EXPR: return reduc_plus_scal_optab; - case VEC_LSHIFT_EXPR: - return vec_shl_optab; - case VEC_RSHIFT_EXPR: return vec_shr_optab; @@ -773,7 +770,7 @@ force_expand_binop (enum machine_mode mode, optab binoptab, return true; } -/* Generate insns for VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR. */ +/* Generate insns for VEC_RSHIFT_EXPR. */ rtx expand_vec_shift_expr (sepops ops, rtx target) @@ -784,21 +781,10 @@ expand_vec_shift_expr (sepops ops, rtx target) enum machine_mode mode = TYPE_MODE (ops->type); tree vec_oprnd = ops->op0; tree shift_oprnd = ops->op1; - optab shift_optab; - switch (ops->code) - { - case VEC_RSHIFT_EXPR: - shift_optab = vec_shr_optab; - break; - case VEC_LSHIFT_EXPR: - shift_optab = vec_shl_optab; - break; - default: - gcc_unreachable (); - } + gcc_assert (ops->code == VEC_RSHIFT_EXPR); - icode = optab_handler (shift_optab, mode); + icode = optab_handler (vec_shr_optab, mode); gcc_assert (icode != CODE_FOR_nothing); rtx_op1 = expand_normal (vec_oprnd); diff --git a/gcc/optabs.def b/gcc/optabs.def index 131ea048b01..a07e1639ed6 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -276,7 +276,6 @@ OPTAB_D (vec_perm_const_optab, "vec_perm_const$a") OPTAB_D (vec_perm_optab, "vec_perm$a") OPTAB_D (vec_realign_load_optab, "vec_realign_load_$a") OPTAB_D (vec_set_optab, "vec_set$a") -OPTAB_D (vec_shl_optab, "vec_shl_$a") OPTAB_D (vec_shr_optab, "vec_shr_$a") OPTAB_D (vec_unpacks_float_hi_optab, "vec_unpacks_float_hi_$a") OPTAB_D (vec_unpacks_float_lo_optab, "vec_unpacks_float_lo_$a") diff --git a/gcc/optabs.h b/gcc/optabs.h index 5d150f618a4..93db5138c90 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -240,7 +240,7 @@ bool expand_vec_cond_expr_p (tree, tree); /* Generate code for VEC_COND_EXPR. */ extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx); -/* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */ +/* Generate code for VEC_RSHIFT_EXPR. */ extern rtx expand_vec_shift_expr (sepops, rtx); /* Return true if target supports vector operations for VEC_PERM_EXPR. */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 761d6f48fb9..a1793e81955 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3673,7 +3673,6 @@ verify_gimple_assign_binary (gimple stmt) return false; } - case VEC_LSHIFT_EXPR: case VEC_RSHIFT_EXPR: { if (TREE_CODE (rhs1_type) != VECTOR_TYPE diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 787f60b5430..ea62c864768 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3696,7 +3696,6 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights, case RSHIFT_EXPR: case LROTATE_EXPR: case RROTATE_EXPR: - case VEC_LSHIFT_EXPR: case VEC_RSHIFT_EXPR: case BIT_IOR_EXPR: diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 63d77cf8ca4..a74d85adc81 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1848,7 +1848,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, case RSHIFT_EXPR: case LROTATE_EXPR: case RROTATE_EXPR: - case VEC_LSHIFT_EXPR: case VEC_RSHIFT_EXPR: case WIDEN_LSHIFT_EXPR: case BIT_IOR_EXPR: @@ -3029,7 +3028,6 @@ op_code_prio (enum tree_code code) case REDUC_MAX_EXPR: case REDUC_MIN_EXPR: case REDUC_PLUS_EXPR: - case VEC_LSHIFT_EXPR: case VEC_RSHIFT_EXPR: case VEC_UNPACK_HI_EXPR: case VEC_UNPACK_LO_EXPR: @@ -3140,9 +3138,6 @@ op_symbol_code (enum tree_code code) case RROTATE_EXPR: return "r>>"; - case VEC_LSHIFT_EXPR: - return "v<<"; - case VEC_RSHIFT_EXPR: return "v>>"; diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 190ba182697..28111ca258f 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1605,7 +1605,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) if (compute_type == type) return; - gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR); + gcc_assert (code != VEC_RSHIFT_EXPR); new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code); /* Leave expression untouched for later expansion. */ diff --git a/gcc/tree.def b/gcc/tree.def index c830e4bad84..ff6be21549f 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -1242,10 +1242,9 @@ DEFTREECODE (WIDEN_LSHIFT_EXPR, "widen_lshift_expr", tcc_binary, 2) before adding operand three. */ DEFTREECODE (FMA_EXPR, "fma_expr", tcc_expression, 3) -/* Whole vector left/right shift in bits. +/* Whole vector right shift in bits. Operand 0 is a vector to be shifted. Operand 1 is an integer shift amount in bits. */ -DEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2) DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2) /* Widening vector multiplication.