From patchwork Tue Jul 1 05:07:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenqiang Chen X-Patchwork-Id: 365867 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 BFC831400D5 for ; Tue, 1 Jul 2014 15:08:13 +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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=cRqderD2wrzeNWEEYm WSjxjLj0To5hUdqfKvOt/qkgVuUSBtQiAGosmfXqqYuDul/BWwENeF49xnfZNi2v H9IGrCnTIKvw+kOBcz1yq8ULHuflRleDGrc2iovYI9SolnLwAxcvqH/0E7zGOAPm FSCwAjbw+bBYyNJ8SuBCt03Z8= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=k4RKmr7bSI2IytHOzxja9L2b cQM=; b=GBsKWGalGz8XaOlYqm62esakxPaczVtM3Rci+/TgmnLfp8AFNozDAdWv RBlfzFIp9+S+uYyo6nl5wMRhBw8JI+gbxazux0xk2oCpqg2vT7hfvkiUEEtjyGTt sfqofPorYsNMcfRMg0YOdHd4vprVKA/+GsYI7FHIrzDm66PdqGg= Received: (qmail 26843 invoked by alias); 1 Jul 2014 05:08:05 -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 26809 invoked by uid 89); 1 Jul 2014 05:08:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f46.google.com Received: from mail-la0-f46.google.com (HELO mail-la0-f46.google.com) (209.85.215.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 01 Jul 2014 05:08:01 +0000 Received: by mail-la0-f46.google.com with SMTP id el20so5556381lab.33 for ; Mon, 30 Jun 2014 22:07:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=dhwexwWe14y5j9g9/5Mcj+tTgPcJGBCeyVTTa5kDM4U=; b=dl24zHxbY0E+jb5/FkXlRZ8zKTDgpBqYN9qzCnj6FpWzejI4OYSpfMCJWgb8Aq4eOk mz+mEs0mGXwyD0PPngTO0We/ZsnCjBy94NGYk60WcxFsyzyD/1SLzqAukBl0dMpQ65lt p4snqFFtfdKpWtJblgVHw8vbeBJejd21+VP0AIdQW9sb3kQ5tmh3Jo9lbym592mv78Pa N1m54wq7dglr6P8fpG6uyhYccRdiutACH8wyr9cIPzFgKM6K6zKwLj/9gZV1EXqrCfYn 5v9cTMF90shKzlp8fYAcppNXq9Qi5NDJiQcAL4MEMt91IRy99gcNVWFHdC1QFrUvyHNX o2vg== X-Gm-Message-State: ALoCoQms8Z4waXGy+cV6Me819ljkRZk0K2T/A4JLi7zEAk2AcTg21G3C2LEmnHjvDaosxdeDL2vy MIME-Version: 1.0 X-Received: by 10.152.115.134 with SMTP id jo6mr33974756lab.6.1404191277817; Mon, 30 Jun 2014 22:07:57 -0700 (PDT) Received: by 10.112.13.36 with HTTP; Mon, 30 Jun 2014 22:07:57 -0700 (PDT) In-Reply-To: <53AADF87.5040705@arm.com> References: <53AADF87.5040705@arm.com> Date: Tue, 1 Jul 2014 13:07:57 +0800 Message-ID: Subject: Re: [PATCH, 2/10] prepare ccmp From: Zhenqiang Chen To: Richard Earnshaw Cc: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes On 25 June 2014 22:41, Richard Earnshaw wrote: > On 23/06/14 07:57, Zhenqiang Chen wrote: >> Hi, >> >> The patch makes several functions global, which will be used when >> expanding ccmp instructions. >> >> The other change in this patch is to check CCMP when turning code into >> jumpy sequence. >> >> OK for trunk? >> > > This isn't a complete review. In particular, I'd like one of the gimple > experts to go over this again. > > However, some general issues do crop up. I'll deal with each patch as I > spot something. > > > enum rtx_code code; >> @@ -6503,6 +6503,12 @@ get_rtx_code (enum tree_code tcode, bool unsignedp) >> code = LTGT; >> break; >> >> + case BIT_AND_EXPR: >> + code = AND; >> + break; >> + case BIT_IOR_EXPR: >> + code = IOR; >> + break; > > Blank lines between case alternatives. Thanks. Patch is updated. extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int, diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index e8cd87f..a32e1b3 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2095,9 +2095,10 @@ expand_gimple_cond (basic_block bb, gimple stmt) op0 = gimple_assign_rhs1 (second); op1 = gimple_assign_rhs2 (second); } - /* If jumps are cheap turn some more codes into - jumpy sequences. */ - else if (BRANCH_COST (optimize_insn_for_speed_p (), false) < 4) + /* If jumps are cheap and the target does not support conditional + compare, turn some more codes into jumpy sequences. */ + else if (BRANCH_COST (optimize_insn_for_speed_p (), false) < 4 + && (targetm.gen_ccmp_first == NULL)) { if ((code2 == BIT_AND_EXPR && TYPE_PRECISION (TREE_TYPE (op0)) == 1 diff --git a/gcc/expmed.c b/gcc/expmed.c index e76b6fc..c8d63a9 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5105,7 +5105,7 @@ expand_and (enum machine_mode mode, rtx op0, rtx op1, rtx target) } /* Helper function for emit_store_flag. */ -static rtx +rtx emit_cstore (rtx target, enum insn_code icode, enum rtx_code code, enum machine_mode mode, enum machine_mode compare_mode, int unsignedp, rtx x, rtx y, int normalizep, diff --git a/gcc/expmed.h b/gcc/expmed.h index 4d01d1f..a567bad 100644 --- a/gcc/expmed.h +++ b/gcc/expmed.h @@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see #ifndef EXPMED_H #define EXPMED_H 1 +#include "insn-codes.h" + enum alg_code { alg_unknown, alg_zero, @@ -665,4 +667,9 @@ convert_cost (enum machine_mode to_mode, enum machine_mode from_mode, } extern int mult_by_coeff_cost (HOST_WIDE_INT, enum machine_mode, bool); + +extern rtx emit_cstore (rtx target, enum insn_code icode, enum rtx_code code, + enum machine_mode mode, enum machine_mode compare_mode, + int unsignedp, rtx x, rtx y, int normalizep, + enum machine_mode target_mode); #endif diff --git a/gcc/expr.c b/gcc/expr.c index 512c024..04cf56e 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -146,8 +146,6 @@ static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_tree); static int is_aligning_offset (const_tree, const_tree); -static void expand_operands (tree, tree, rtx, rtx*, rtx*, - enum expand_modifier); static rtx reduce_to_bit_field_precision (rtx, rtx, tree); static rtx do_store_flag (sepops, rtx, enum machine_mode); #ifdef PUSH_ROUNDING @@ -7496,7 +7494,7 @@ convert_tree_comp_to_rtx (enum tree_code tcode, int unsignedp) The value may be stored in TARGET if TARGET is nonzero. The MODIFIER argument is as documented by expand_expr. */ -static void +void expand_operands (tree exp0, tree exp1, rtx target, rtx *op0, rtx *op1, enum expand_modifier modifier) { diff --git a/gcc/expr.h b/gcc/expr.h index 6a1d3ab..66ca82f 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -787,4 +787,6 @@ extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, by EXP. This does not include any offset in DECL_FIELD_BIT_OFFSET. */ extern tree component_ref_field_offset (tree); +extern void expand_operands (tree, tree, rtx, rtx*, rtx*, + enum expand_modifier); #endif /* GCC_EXPR_H */ diff --git a/gcc/optabs.c b/gcc/optabs.c index ca1c194..0c3dae1 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -6453,7 +6453,7 @@ gen_cond_trap (enum rtx_code code, rtx op1, rtx op2, rtx tcode) /* Return rtx code for TCODE. Use UNSIGNEDP to select signed or unsigned operation code. */ -static enum rtx_code +enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp) { enum rtx_code code; @@ -6503,6 +6503,14 @@ get_rtx_code (enum tree_code tcode, bool unsignedp) code = LTGT; break; + case BIT_AND_EXPR: + code = AND; + break; + + case BIT_IOR_EXPR: + code = IOR; + break; + default: gcc_unreachable (); } diff --git a/gcc/optabs.h b/gcc/optabs.h index 089b15a..61be4e2 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -91,6 +91,7 @@ extern rtx expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op, extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab, rtx op0, rtx op1, rtx op2, rtx target, int unsignedp); +extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp); /* Expand a binary operation given optab and rtx operands. */