From patchwork Thu Jan 14 10:26:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Lawrence X-Patchwork-Id: 567310 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 D53DD1402BC for ; Thu, 14 Jan 2016 21:26:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=pDbtrJT+; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id; q=dns; s=default; b=bglL0LYACHq6LcK bAXtKkDYITV9jyZKF6n/dVSqNFolCpSCpj+3L7XNakRmcgv4U6boak9qh3dkw5mx k8IC9Vx5U5H/YLgdn5+Xj+6IZUQDU84vjZSjCxPlNkn2YpDhHg+TLOEfx4kakZTz U+RZOI0XrOUGKuT/4+2l+N5B3DAg= 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:from :to:subject:date:message-id; s=default; bh=BegA5p495IiNh+N7kgo06 fid4Ko=; b=pDbtrJT+IRA9D3pGJr9pPsj/sAxWqh5ISTpdrpPIwfu5l1RvGQvSS uNGZMguDIXLpcai4SIw6Bzil77jLc9gqc5lOyqZc+loQtZznbmtDb/2tKoUhNqbp jU2ARWW8On6XPyaulgJ9bUitkP+4foOhH2NwIBA30A/ssELXxP6Erc= Received: (qmail 30787 invoked by alias); 14 Jan 2016 10:26:35 -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 30772 invoked by uid 89); 14 Jan 2016 10:26:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Fall, UD:optabs-tree.c, UD:md.texi, bitsize X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Jan 2016 10:26:31 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5557C49 for ; Thu, 14 Jan 2016 02:25:54 -0800 (PST) Received: from arm.com (e105915-lin.emea.arm.com [10.2.206.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DBF763F2E5 for ; Thu, 14 Jan 2016 02:26:29 -0800 (PST) From: Alan Lawrence To: gcc-patches@gcc.gnu.org Subject: [PATCH] Tidy: remove reduc_xxx_optab migration code Date: Thu, 14 Jan 2016 10:26:17 +0000 Message-Id: <1452767177-31956-1-git-send-email-alan.lawrence@arm.com> X-IsSubscribed: yes If/when mips-ps-3d.md is moved from reduc_* to reduc_*_scal optabs (patch here: https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00311.html ), there will be no uses of the old reduc_* optabs remaining. This patch removes those optabs and the migration path. Bootstrapped + check-gcc + check-g++ on x86_64 and AArch64. I'm not sure whether such a code tidy is acceptable for stage 3, please advise? Thanks, Alan gcc/ChangeLog: * doc/md.texi (reduc_smin_@var{m}, reduc_smax_@var{m}, reduc_umin_@var{m}, reduc_umax_@var{m}, reduc_splus_@var{m}, reduc_uplus_@var{m}): Remove. * expr.c (expand_expr_real_2): Remove expansion path for reduc_[us](min|max|plus) optabs. * optabs-tree.c (scalar_reduc_to_vector): Remove. * optabs-tree.h (scalar_reduc_to_vector): Remove. * optabs.def (reduc_smax_optab, reduc_smin_optab, reduc_splus_optab, reduc_umax_optab, reduc_umin_optab, reduc_uplus_optab): Remove. * tree-vect-loop.c (vectorizable_reduction): Remove test for reduc_[us](min|max|plus) optabs. --- gcc/doc/md.texi | 27 --------------------------- gcc/expr.c | 39 ++++++++++----------------------------- gcc/optabs-tree.c | 20 -------------------- gcc/optabs-tree.h | 1 - gcc/optabs.def | 7 ------- gcc/tree-vect-loop.c | 12 ++++-------- 6 files changed, 14 insertions(+), 92 deletions(-) diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index faf3910..68321dc 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5007,33 +5007,6 @@ raised and a quiet @code{NaN} is returned. All operands have mode @var{m}, which is a scalar or vector floating-point mode. These patterns are not allowed to @code{FAIL}. -@cindex @code{reduc_smin_@var{m}} instruction pattern -@cindex @code{reduc_smax_@var{m}} instruction pattern -@item @samp{reduc_smin_@var{m}}, @samp{reduc_smax_@var{m}} -Find the signed minimum/maximum of the elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of -operand 0 (also a vector). The output and input vector should have the same -modes. These are legacy optabs, and platforms should prefer to implement -@samp{reduc_smin_scal_@var{m}} and @samp{reduc_smax_scal_@var{m}}. - -@cindex @code{reduc_umin_@var{m}} instruction pattern -@cindex @code{reduc_umax_@var{m}} instruction pattern -@item @samp{reduc_umin_@var{m}}, @samp{reduc_umax_@var{m}} -Find the unsigned minimum/maximum of the elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of -operand 0 (also a vector). The output and input vector should have the same -modes. These are legacy optabs, and platforms should prefer to implement -@samp{reduc_umin_scal_@var{m}} and @samp{reduc_umax_scal_@var{m}}. - -@cindex @code{reduc_splus_@var{m}} instruction pattern -@cindex @code{reduc_uplus_@var{m}} instruction pattern -@item @samp{reduc_splus_@var{m}}, @samp{reduc_uplus_@var{m}} -Compute the sum of the signed/unsigned elements of a vector. The vector is -operand 1, and the result is stored in the least significant bits of operand 0 -(also a vector). The output and input vector should have the same modes. -These are legacy optabs, and platforms should prefer to implement -@samp{reduc_plus_scal_@var{m}}. - @cindex @code{reduc_smin_scal_@var{m}} instruction pattern @cindex @code{reduc_smax_scal_@var{m}} instruction pattern @item @samp{reduc_smin_scal_@var{m}}, @samp{reduc_smax_scal_@var{m}} diff --git a/gcc/expr.c b/gcc/expr.c index 8973893..e1ed44d 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9164,35 +9164,16 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, this_optab = optab_for_tree_code (code, type, optab_default); machine_mode vec_mode = TYPE_MODE (TREE_TYPE (treeop0)); - if (optab_handler (this_optab, vec_mode) != CODE_FOR_nothing) - { - struct expand_operand ops[2]; - enum insn_code icode = optab_handler (this_optab, vec_mode); - - create_output_operand (&ops[0], target, mode); - create_input_operand (&ops[1], op0, vec_mode); - if (maybe_expand_insn (icode, 2, ops)) - { - target = ops[0].value; - if (GET_MODE (target) != mode) - return gen_lowpart (tmode, target); - return target; - } - } - /* Fall back to optab with vector result, and then extract scalar. */ - this_optab = scalar_reduc_to_vector (this_optab, type); - temp = expand_unop (vec_mode, this_optab, op0, NULL_RTX, unsignedp); - gcc_assert (temp); - /* The tree code produces a scalar result, but (somewhat by convention) - the optab produces a vector with the result in element 0 if - little-endian, or element N-1 if big-endian. So pull the scalar - result out of that element. */ - int index = BYTES_BIG_ENDIAN ? GET_MODE_NUNITS (vec_mode) - 1 : 0; - int bitsize = GET_MODE_UNIT_BITSIZE (vec_mode); - temp = extract_bit_field (temp, bitsize, bitsize * index, unsignedp, - target, mode, mode, false); - gcc_assert (temp); - return temp; + struct expand_operand ops[2]; + enum insn_code icode = optab_handler (this_optab, vec_mode); + + create_output_operand (&ops[0], target, mode); + create_input_operand (&ops[1], op0, vec_mode); + expand_insn (icode, 2, ops); + target = ops[0].value; + if (GET_MODE (target) != mode) + return gen_lowpart (tmode, target); + return target; } case VEC_UNPACK_HI_EXPR: diff --git a/gcc/optabs-tree.c b/gcc/optabs-tree.c index d9dd3fc..a229b97 100644 --- a/gcc/optabs-tree.c +++ b/gcc/optabs-tree.c @@ -246,26 +246,6 @@ optab_for_tree_code (enum tree_code code, const_tree type, } } -/* Given optab UNOPTAB that reduces a vector to a scalar, find instead the old - optab that produces a vector with the reduction result in one element, - for a tree with type TYPE. */ - -optab -scalar_reduc_to_vector (optab unoptab, const_tree type) -{ - switch (unoptab) - { - case reduc_plus_scal_optab: - return TYPE_UNSIGNED (type) ? reduc_uplus_optab : reduc_splus_optab; - - case reduc_smin_scal_optab: return reduc_smin_optab; - case reduc_umin_scal_optab: return reduc_umin_optab; - case reduc_smax_scal_optab: return reduc_smax_optab; - case reduc_umax_scal_optab: return reduc_umax_optab; - default: return unknown_optab; - } -} - /* Function supportable_convert_operation Check whether an operation represented by the code CODE is a diff --git a/gcc/optabs-tree.h b/gcc/optabs-tree.h index 0727925..c3b9280 100644 --- a/gcc/optabs-tree.h +++ b/gcc/optabs-tree.h @@ -36,7 +36,6 @@ enum optab_subtype the second argument. The third argument distinguishes between the types of vector shifts and rotates. */ optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype); -optab scalar_reduc_to_vector (optab, const_tree); bool supportable_convert_operation (enum tree_code, tree, tree, tree *, enum tree_code *); bool expand_vec_cmp_expr_p (tree, tree); diff --git a/gcc/optabs.def b/gcc/optabs.def index 4faedc6..c938b42 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -285,13 +285,6 @@ OPTAB_D (reduc_smin_scal_optab, "reduc_smin_scal_$a") OPTAB_D (reduc_plus_scal_optab, "reduc_plus_scal_$a") OPTAB_D (reduc_umax_scal_optab, "reduc_umax_scal_$a") OPTAB_D (reduc_umin_scal_optab, "reduc_umin_scal_$a") -/* (Old) Vector reduction, returning a vector with the result in one lane. */ -OPTAB_D (reduc_smax_optab, "reduc_smax_$a") -OPTAB_D (reduc_smin_optab, "reduc_smin_$a") -OPTAB_D (reduc_splus_optab, "reduc_splus_$a") -OPTAB_D (reduc_umax_optab, "reduc_umax_$a") -OPTAB_D (reduc_umin_optab, "reduc_umin_$a") -OPTAB_D (reduc_uplus_optab, "reduc_uplus_$a") OPTAB_D (sdot_prod_optab, "sdot_prod$I$a") OPTAB_D (ssum_widen_optab, "widen_ssum$I$a3") diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index a82cf26..d658d9b 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5743,15 +5743,11 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, } else if (optab_handler (reduc_optab, vec_mode) == CODE_FOR_nothing) { - optab = scalar_reduc_to_vector (reduc_optab, vectype_out); - if (optab_handler (optab, vec_mode) == CODE_FOR_nothing) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "reduc op not supported by target.\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduc op not supported by target.\n"); - epilog_reduc_code = ERROR_MARK; - } + epilog_reduc_code = ERROR_MARK; } /* When epilog_reduc_code is ERROR_MARK then a reduction will be