From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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: Wed, 12 Aug 2015 01:12:00 -0000 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 X-SW-Source: 2015-08/txt/msg00563.txt.bz2 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, -- 2.4.3