From patchwork Wed Aug 12 01:11:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 506303 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 8524014016A for ; Wed, 12 Aug 2015 11:15:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jyZvtYYa; 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:in-reply-to:references; q=dns; s= default; b=NpM+uXGX+qpfbFWoYGYTjMjusHhxr6g7Z8bBbPzDSNJ741dqTHc3I c4jVponyBwVXC1rAsxOzoc0MBvDas2q1JK5RhFQnFMGh9CZf82F05kZisInt3ZKZ mF5Nr0XXhYsqeyEwjstF3stHSJV8YbSxNAl0hY7IL5Vh1pWLNOxlEM= 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:in-reply-to:references; s=default; bh=OQhoIkwrpYAki7VJeA120iOZakU=; b=jyZvtYYaYpGyGgDZib2rYaNQBgMu ++cbpkb2QiVsSIyusAAU12WAhh4abdhqQMCFITwJGdzv+FgDxnJqg9QusQ395/Uq q03XUzc+RFg3n8T63XJsCZcGMviLQl0Mhm5onm8CEHGTuqDUvrS0xNAVzp6kc+TN NcfPKxvSt8fXINw= Received: (qmail 77631 invoked by alias); 12 Aug 2015 01:12:08 -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 77107 invoked by uid 89); 12 Aug 2015 01:12:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f41.google.com Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 12 Aug 2015 01:12:00 +0000 Received: by pabyb7 with SMTP id yb7so2255718pab.0 for ; Tue, 11 Aug 2015 18:11:58 -0700 (PDT) X-Received: by 10.66.119.239 with SMTP id kx15mr63225413pab.156.1439341918460; Tue, 11 Aug 2015 18:11:58 -0700 (PDT) Received: from bigtime.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id kv10sm4167810pbc.2.2015.08.11.18.11.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 18:11:57 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Subject: [PATCH 14/15] alpha: Split out alpha_cost_set_const Date: Tue, 11 Aug 2015 18:11:43 -0700 Message-Id: <1439341904-9345-15-git-send-email-rth@redhat.com> In-Reply-To: <1439341904-9345-1-git-send-email-rth@redhat.com> References: <1439341904-9345-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes Now that it's easy, avoid the "no_output" parameter to alpha_emit_set_const. --- * config/alpha/alpha.c (alpha_cost_set_const): New. (alpha_legitimate_constant_p): Use it (alpha_emit_set_const): Remove no_output param. (alpha_split_const_mov): Update call. (alpha_expand_epilogue): Likewise. --- gcc/config/alpha/alpha.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 6933601..cc25250 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1998,6 +1998,18 @@ genimm_alpha::generate (rtx dest, machine_mode mode) const } // anon namespace +/* Return the cost of outputting the constant C in MODE. */ + +static int +alpha_cost_set_const (machine_mode mode, HOST_WIDE_INT c) +{ + if (mode == V8QImode || mode == V4HImode || mode == V2SImode) + mode = DImode; + + genimm_alpha data = genimm_hash::hash (c, mode); + return data.cost; +} + /* Try to output insns to set TARGET equal to the constant C if it can be done in less than N insns. Do all computations in MODE. Returns the place where the output has been placed if it can be done and the insns have been @@ -2006,7 +2018,7 @@ genimm_alpha::generate (rtx dest, machine_mode mode) const static rtx alpha_emit_set_const (rtx target, machine_mode origmode, - HOST_WIDE_INT c, int n, bool no_output) + HOST_WIDE_INT c, int n) { machine_mode mode = origmode; if (mode == V8QImode || mode == V4HImode || mode == V2SImode) @@ -2016,10 +2028,6 @@ alpha_emit_set_const (rtx target, machine_mode origmode, if (data.cost > n) return NULL; - /* If we're not emitting output, we only need return a nonnull value. */ - if (no_output) - return pc_rtx; - if (origmode == mode) data.generate (target, mode); else @@ -2132,7 +2140,7 @@ alpha_legitimate_constant_p (machine_mode mode, rtx x) mode = DImode; gcc_assert (CONST_WIDE_INT_NUNITS (x) == 2); i0 = CONST_WIDE_INT_ELT (x, 1); - if (alpha_emit_set_const (NULL_RTX, mode, i0, 3, true) == NULL) + if (alpha_cost_set_const (mode, i0) > 3) return false; i0 = CONST_WIDE_INT_ELT (x, 0); goto do_integer; @@ -2156,7 +2164,7 @@ alpha_legitimate_constant_p (machine_mode mode, rtx x) return true; i0 = alpha_extract_integer (x); do_integer: - return alpha_emit_set_const (NULL_RTX, mode, i0, 3, true) != NULL; + return alpha_cost_set_const (mode, i0) <= 3; default: return false; @@ -2174,7 +2182,7 @@ alpha_split_const_mov (machine_mode mode, rtx *operands) i0 = alpha_extract_integer (operands[1]); - temp = alpha_emit_set_const (operands[0], mode, i0, 3, false); + temp = alpha_emit_set_const (operands[0], mode, i0, 3); if (!temp && TARGET_BUILD_CONSTANTS) temp = alpha_emit_set_long_const (operands[0], i0); @@ -8212,7 +8220,7 @@ alpha_expand_epilogue (void) else { rtx tmp = gen_rtx_REG (DImode, 23); - sp_adj2 = alpha_emit_set_const (tmp, DImode, frame_size, 3, false); + sp_adj2 = alpha_emit_set_const (tmp, DImode, frame_size, 3); if (!sp_adj2) { /* We can't drop new things to memory this late, afaik,