From patchwork Wed Nov 12 17:55:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 410070 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 1AD671400E7 for ; Thu, 13 Nov 2014 04:55:48 +1100 (AEDT) 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:in-reply-to :content-type; q=dns; s=default; b=WSqFckwVb+yOwdO3TjkWlSk8pqBII N7/kJxdM6uNUC4iXS5l2bD8GZrZ8hqN02cSEe5qAE2H7C+mugoJPFZRifjLvuh5y YLmmBFTGhaR9wCMVflum++UZGScx1M0/Il2ci9kYUbsVw+5WYTV35XKSgf/pxbu0 Qp6HE9urzXQmO4= 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:in-reply-to :content-type; s=default; bh=lgbAbKrlLlharL6GKmdBC4fxEqY=; b=XNT l8Fn6v3Zhm1HSiFkZFs1M92IfvPkEbaiFOuA2TsciUMGs8Ldas8y4m9fWUeAoc/b ohByJN3Z4Cs/H1Dt8giHV4nrJHR3Yr77W9kpYkMNk46nbO67fUyw3nQy8qvcQQCX KA+f7q7SNh1yIMuoiJEj06g6wsgCXMGf0B/zcQLY= Received: (qmail 12336 invoked by alias); 12 Nov 2014 17:55:36 -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 12246 invoked by uid 89); 12 Nov 2014 17:55:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 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; Wed, 12 Nov 2014 17:55:32 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 12 Nov 2014 17:55:30 +0000 Received: from [10.1.209.51] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 12 Nov 2014 17:55:28 +0000 Message-ID: <54639F0F.6010806@arm.com> Date: Wed, 12 Nov 2014 17:55:27 +0000 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [PATCH 3/4] Remove VEC_RSHIFT_EXPR tree code, now unused In-Reply-To: <54639D83.7090205@arm.com> X-MC-Unique: 114111217553010901 X-IsSubscribed: yes Tested (with patches 1+2): Bootstrap + check-gcc on x64-none-linux-gnu cross-tested check-gcc on aarch64-none-elf and aarch64_be-none-elf as these platforms stand (i.e. without vec_shr_optab). also cross-tested check-gcc on aarch64-none-elf and aarch64_be-none-elf after applying https://gcc.gnu.org/ml/gcc-patches/2014-09/msg01473.html (which adds a vec_shr_ pattern). bootstrap on powerpc64-none-linux-gnu; check-gcc in progress. gcc/ChangeLog: * fold-const.c (const_binop): Remove code handling VEC_RSHIFT_EXPR. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node, op_code_prio, op_symbol_code): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Remove assertion against VEC_RSHIFT_EXPR. * optabs.h (expand_vec_shift_expr): Remove. * optabs.c (optab_for_tree_code): Remove case VEC_RSHIFT_EXPR. (expand_vec_shift_expr): Remove. * tree.def (VEC_RSHIFT_EXPR): Remove diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 2df8ce3..15d7638 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4659,7 +4659,6 @@ expand_debug_expr (tree exp) case VEC_PACK_FIX_TRUNC_EXPR: case VEC_PACK_SAT_EXPR: case VEC_PACK_TRUNC_EXPR: - case VEC_RSHIFT_EXPR: case VEC_UNPACK_FLOAT_HI_EXPR: case VEC_UNPACK_FLOAT_LO_EXPR: case VEC_UNPACK_HI_EXPR: diff --git a/gcc/expr.c b/gcc/expr.c index 0ef06ea..fb8455c 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9143,12 +9143,6 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, return temp; } - case VEC_RSHIFT_EXPR: - { - target = expand_vec_shift_expr (ops, target); - return target; - } - case VEC_UNPACK_HI_EXPR: case VEC_UNPACK_LO_EXPR: { diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 13faf0c..22f5704 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1419,44 +1419,17 @@ 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_RSHIFT_EXPR) + for (i = 0; i < count; i++) { - if (!tree_fits_uhwi_p (arg2)) - return NULL_TREE; + tree elem1 = VECTOR_CST_ELT (arg1, i); - unsigned HOST_WIDE_INT shiftc = tree_to_uhwi (arg2); - unsigned HOST_WIDE_INT outerc = tree_to_uhwi (TYPE_SIZE (type)); - unsigned HOST_WIDE_INT innerc - = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (type))); - if (shiftc >= outerc || (shiftc % innerc) != 0) + elts[i] = const_binop (code, elem1, arg2); + + /* It is possible that const_binop cannot handle the given + code and return NULL_TREE. */ + if (elts[i] == NULL_TREE) return NULL_TREE; - int offset = shiftc / innerc; - /* 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++) - { - if (i + offset < 0 || i + offset >= count) - elts[i] = zero; - else - elts[i] = VECTOR_CST_ELT (arg1, i + offset); - } } - else - for (i = 0; i < count; i++) - { - tree elem1 = VECTOR_CST_ELT (arg1, i); - - elts[i] = const_binop (code, elem1, arg2); - - /* It is possible that const_binop cannot handle the given - code and return NULL_TREE */ - if (elts[i] == NULL_TREE) - return NULL_TREE; - } return build_vector (type, elts); } diff --git a/gcc/optabs.c b/gcc/optabs.c index 6194b45..b67828c 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -520,9 +520,6 @@ optab_for_tree_code (enum tree_code code, const_tree type, case REDUC_PLUS_EXPR: return reduc_plus_scal_optab; - case VEC_RSHIFT_EXPR: - return vec_shr_optab; - case VEC_WIDEN_MULT_HI_EXPR: return TYPE_UNSIGNED (type) ? vec_widen_umult_hi_optab : vec_widen_smult_hi_optab; @@ -771,34 +768,6 @@ force_expand_binop (machine_mode mode, optab binoptab, return true; } -/* Generate insns for VEC_RSHIFT_EXPR. */ - -rtx -expand_vec_shift_expr (sepops ops, rtx target) -{ - struct expand_operand eops[3]; - enum insn_code icode; - rtx rtx_op1, rtx_op2; - machine_mode mode = TYPE_MODE (ops->type); - tree vec_oprnd = ops->op0; - tree shift_oprnd = ops->op1; - - gcc_assert (ops->code == VEC_RSHIFT_EXPR); - - icode = optab_handler (vec_shr_optab, mode); - gcc_assert (icode != CODE_FOR_nothing); - - rtx_op1 = expand_normal (vec_oprnd); - rtx_op2 = expand_normal (shift_oprnd); - - create_output_operand (&eops[0], target, mode); - create_input_operand (&eops[1], rtx_op1, GET_MODE (rtx_op1)); - create_convert_operand_from_type (&eops[2], rtx_op2, TREE_TYPE (shift_oprnd)); - expand_insn (icode, 3, eops); - - return eops[0].value; -} - /* Create a new vector value in VMODE with all elements set to OP. The mode of OP must be the element mode of VMODE. If OP is a constant, then the return value will be a constant. */ diff --git a/gcc/optabs.h b/gcc/optabs.h index 91e36d6..982a593 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -287,8 +287,6 @@ extern rtx simplify_expand_binop (machine_mode mode, optab binoptab, enum optab_methods methods); extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int, enum optab_methods); -/* Generate code for VEC_RSHIFT_EXPR. */ -extern rtx expand_vec_shift_expr (struct separate_ops *, rtx); /* Generate code for a simple binary or unary operation. "Simple" in this case means "can be unambiguously described by a (mode, code) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index ee10bc6..904f2dd 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3675,38 +3675,6 @@ verify_gimple_assign_binary (gimple stmt) return false; } - case VEC_RSHIFT_EXPR: - { - if (TREE_CODE (rhs1_type) != VECTOR_TYPE - || !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)) - || POINTER_TYPE_P (TREE_TYPE (rhs1_type)) - || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type)) - || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))) - || (!INTEGRAL_TYPE_P (rhs2_type) - && (TREE_CODE (rhs2_type) != VECTOR_TYPE - || !INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type)))) - || !useless_type_conversion_p (lhs_type, rhs1_type)) - { - error ("type mismatch in vector shift expression"); - debug_generic_expr (lhs_type); - debug_generic_expr (rhs1_type); - debug_generic_expr (rhs2_type); - return true; - } - /* For shifting a vector of non-integral components we - only allow shifting by a constant multiple of the element size. */ - if (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type)) - && (TREE_CODE (rhs2) != INTEGER_CST - || !div_if_zero_remainder (rhs2, - TYPE_SIZE (TREE_TYPE (rhs1_type))))) - { - error ("non-element sized vector shift of floating point vector"); - return true; - } - - return false; - } - case WIDEN_LSHIFT_EXPR: { if (!INTEGRAL_TYPE_P (lhs_type) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8cb9510..520546e 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3807,7 +3807,6 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights, case RSHIFT_EXPR: case LROTATE_EXPR: case RROTATE_EXPR: - case VEC_RSHIFT_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index b8abd14..53720de 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1858,7 +1858,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, case RSHIFT_EXPR: case LROTATE_EXPR: case RROTATE_EXPR: - case VEC_RSHIFT_EXPR: case WIDEN_LSHIFT_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: @@ -3038,7 +3037,6 @@ op_code_prio (enum tree_code code) case REDUC_MAX_EXPR: case REDUC_MIN_EXPR: case REDUC_PLUS_EXPR: - case VEC_RSHIFT_EXPR: case VEC_UNPACK_HI_EXPR: case VEC_UNPACK_LO_EXPR: case VEC_UNPACK_FLOAT_HI_EXPR: @@ -3148,9 +3146,6 @@ op_symbol_code (enum tree_code code) case RROTATE_EXPR: return "r>>"; - case VEC_RSHIFT_EXPR: - return "v>>"; - case WIDEN_LSHIFT_EXPR: return "w<<"; diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index a0c1363..bd9df15 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1604,7 +1604,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi) if (compute_type == type) return; - 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 91359a2..e4625d0 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -1251,11 +1251,6 @@ DEFTREECODE (WIDEN_LSHIFT_EXPR, "widen_lshift_expr", tcc_binary, 2) before adding operand three. */ DEFTREECODE (FMA_EXPR, "fma_expr", tcc_expression, 3) -/* 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_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2) - /* Widening vector multiplication. The two operands are vectors with N elements of size S. Multiplying the elements of the two vectors will result in N products of size 2*S.