From patchwork Thu Sep 18 12:35:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 390799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0E4291401AF for ; Thu, 18 Sep 2014 22:35:49 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=RrqeFg/XORiHcqk/w +xyyHY6+SYXcRnVojPeDlIV8edRBvGjS1fBPnqTkMy+uv2PNMSSSGiwUQxsDBjBo sUZnyTj+jw+t7PK250j4KngPU7Kwt/1v9f0KtqhctGP6pYM0jES4kGMo+McYQ3oh 3JqHVhqkLiN55Y0RApzua8jiJY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=EXz9acujYF07fb7Rti9bRjx Kj+c=; b=gwl1hiV6qvBnRbq12+n5sSaJvWv+GfBiMkqFD9UWS1Hz0/BWtYkrG4G W5eBI9E/7SjtZQD3VDoRk5QkNlTN8l0+8o7V/TbzB4ffmvalGfO8NtXztc8OeY23 C04Mu4CXhcohA9J1Futf1ZdU6YSR9AO1b9PNVaCGde7zTGRFDw5c= Received: (qmail 30372 invoked by alias); 18 Sep 2014 12:35:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30361 invoked by uid 89); 18 Sep 2014 12:35:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Sep 2014 12:35:41 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 18 Sep 2014 13:35:38 +0100 Received: from [10.1.209.51] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Sep 2014 13:35:37 +0100 Message-ID: <541AD198.4060504@arm.com> Date: Thu, 18 Sep 2014 13:35:36 +0100 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH 11/14] Remove VEC_LSHIFT_EXPR and vec_shl_optab References: <541AC4D2.9040901@arm.com> In-Reply-To: <541AC4D2.9040901@arm.com> X-MC-Unique: 114091813353800401 X-IsSubscribed: yes The VEC_LSHIFT_EXPR tree code, and the corresponding vec_shl_optab, seem to have been added for completeness, providing a counterpart to VEC_RSHIFT_EXPR and vec_shr_optab. However, whereas VEC_RSHIFT_EXPRs are generated (only) by the vectorizer, VEC_LSHIFT_EXPR expressions are not generated at all, so there seems little point in maintaining it. Bootstrapped on x86_64-unknown-linux-gnu. aarch64.exp+vect.exp on aarch64-none-elf and aarch64_be-none-elf. gcc/ChangeLog: * 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, dump_generic_node, op_code_prio, op_symbol_code): 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. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index f6da5d632f441544fdacafc266e9cf17083a825a..6b46b08538c01190215a174773dfcb1109134873 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4592,7 +4592,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 a78aea2f3f6e35b0d89719a42d734e62a2f5bd65..f94e0f62c622d43e2df0d0619fb1eba74c415165 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -4883,10 +4883,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, which must be a multiple of the element size. diff --git a/gcc/expr.c b/gcc/expr.c index 11930ca121e4e1f3807261a2e5b0ca4f6723176d..30ea87af3ef102d7071c6c29db37df875af316f5 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9053,7 +9053,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 b8baa94d37a74ebb824e2a4d03f2a10befcdf749..bd4ba5f0c64c710df9fa36d4059f7b08e949fae0 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1406,8 +1406,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; @@ -1419,11 +1418,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 e422bcce18d06a39b26547b510c35858efc2303e..9c5b5daa6f2b51bda5ba92fcd61534f1dd55e646 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -515,9 +515,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; @@ -765,7 +762,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) @@ -776,21 +773,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 131ea048b012b073345be3b426d4ac8f33061809..a07e1639ed680ad49765cfe7b2df020df06f4e29 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 d9f4900620a13d74fc3dfb1bac9bcb34416012de..1085047721ed1350866de3b1c981531a3095d93e 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 1ea2e256b09b25331810a57a9c35e5cc875d0404..7b73090f26b001db400c436dae8a250c0d06a6dc 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3648,7 +3648,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 b6ecaa4b25a9a7f907ace67332ae6b1540189c4c..ca5a676a2c5b93c6e7adfdc6b5e3d96847c797dc 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3689,7 +3689,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 aee03319cf0bb8fa06fb420d111461b036749164..2d18d56115bcc0873f88973865cf98164c466491 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1836,7 +1836,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: @@ -3001,7 +3000,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: @@ -3112,9 +3110,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 f631c99cc0b2a5af244033162f86bb409575d494..b9a0aea6ddd58f972e05fbd506981a10687b349b 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1595,7 +1595,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 5406ffe67c53ff3f12920ca8c965cf0740a079c2..ff56bfc18bc00e8dac2dfc072fd4fa878a0f2a04 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -1238,11 +1238,10 @@ 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, which must be a multiple of the element size. */ -DEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2) DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2) /* Widening vector multiplication.