From patchwork Mon Sep 11 17:16:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 112208 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4100994qgf; Mon, 11 Sep 2017 10:17:02 -0700 (PDT) X-Received: by 10.84.175.195 with SMTP id t61mr14454189plb.296.1505150222625; Mon, 11 Sep 2017 10:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505150222; cv=none; d=google.com; s=arc-20160816; b=LcauQS8w43dLXsy3YpklyCKBHlrvlNFuVh7K0vFc305+Jpws2t8r6GoF2OgXZ/ikfP j3G3J2mGBHgMgRx/D9h4rcbUI+T5QjnM7ZpRtKb8Hbgosl8fra/WqNnBPo8E51fdR+vq NNjzXyJN1p0AGqzSNFlj4maMjh7eZuJiWKEkSdZxjPGOTMxhwHmHKBzq31j9G3QtKvPd HEhr4SM1IYB+Zv8VvZxWr1CAoAZSgh4RJbYq+qIepTFdCqHuIzsLdB2Aw1dCWQMmJ7oV GXQIGEtP5bNdeHtcAYCNRvvd9bBvh2w9rEOxikZwn8WdrbMMiVqZtcvlMxLzhWiqn0j9 zlPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=Y0+An5pxUpUmc0kPSKZO+VwHpZRQkgH6UZ5jlFLVZ2c=; b=ZME1DavzUhRimPZXbymkdHYikvRtMy0A6+p41/BOIOzsw+tAVgpgXJFbQM3ED8M4st AuvS+cMWHYEvyltGwORLyRdCyFOJmHSggOk/XmeXNySE8w+C6oqxVY0FF8US3aHRJgL+ FON+6rRVrFELcPx4XtCnHrgYvAGZy8iKANVJL34Ttmc5Ki3J2nnAtOQayqKpu2Lsee9p UecrN5KRcZ1NVEHY2x2BtMrR/0LdvPBUFYejVpHFXmM8Z+8ecxQ9s31IR0WC1WXmiTlH g7pzCvQdspOrk/1kA6strhrXYZSkMFSXG9PM0Fcpce4mMJ1d/1+cBmm/Cv/Jcl4m0yXb okLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xmVoBede; spf=pass (google.com: domain of gcc-patches-return-461840-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461840-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k71si4007562pgd.749.2017.09.11.10.17.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Sep 2017 10:17:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-461840-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=xmVoBede; spf=pass (google.com: domain of gcc-patches-return-461840-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461840-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:mime-version:content-type; q=dns; s= default; b=fGF+WWyEI1uVLd2+CPFfR2t/MZhYG6b2+iTiZErwS5v3msszzKN2Z ejgQlZ+mq57xSB3C97rExAxl1uUZOYCsMUemKosL31SCJwBcg71LZdcHLn9pDwj9 81FSRFacgvbVEP9UIp9v7LyoVYmWWJNrqvWAaszY5duO25Hux9PYE4= 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:mime-version:content-type; s= default; bh=VkOXHMl6xuU4WGwo9nyzDuZx218=; b=xmVoBede4BWT9DBmA67d iF7h7gzdeP7i+HE5Jn7fYSdQdzS+lFyTj2+EBhHlOT+yYW+ehoh7DwSfdRXFFabX j19U4kt3c8tDB4mVB1xr4xUKTHBCfGlRNfaF+YlB9N49O8VvpWU/d39dQfR/c2Yy T5YHEydsvkCAAdG5RNOMDis= Received: (qmail 61949 invoked by alias); 11 Sep 2017 17:16:50 -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 61153 invoked by uid 89); 11 Sep 2017 17:16:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1638 X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Sep 2017 17:16:48 +0000 Received: by mail-wm0-f47.google.com with SMTP id i189so44993757wmf.1 for ; Mon, 11 Sep 2017 10:16:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=Y0+An5pxUpUmc0kPSKZO+VwHpZRQkgH6UZ5jlFLVZ2c=; b=DQ2ixlrK/DRARXhAcrJ62AkecuC7JW/dIXk2+mxL73kZQyfc/Z1kf3UEw4qh13PfNm yccXxnMMhYobgaNsjMiALJbhvRL2FW8RI0+Ko2KlvljXkb3jJt42oQtYNnR+J0vHI0Pl l5WjF4IHkQES8uaV5scv6RPLne1EtvV9Lg+Nq3OHMDZ+hHi2eaJySYtI4mRpQeTrlNzo ce8ME+T+jeu5j5K/P3kVkHasY7ZMjtLtKP/Ehnlm/rBPcgkVz2e8xiWwTHmRv5PgUCyy eXS8UMvgCUJP61Ca/GXoPTQn7XwWnWgZv9NYVA862NisyoLyco9bSCR3UybqR0vMpLzh ymmQ== X-Gm-Message-State: AHPjjUiJwzMTorCxOt8mHZhDpXz3kGWoqaPBe0Mgn9Lgtn24picvIRF5 SodT6g/G+uHYd3Cau5fdQBBMaJWzCTw= X-Google-Smtp-Source: AOwi7QCoYwJ4S5kuTjT6SJtNQY0GhxdyRN5TVGjvF6iaGe7zsiq/p9J5XQ694z07KA46sTeQwSWiOg== X-Received: by 10.28.55.209 with SMTP id e200mr8095532wma.72.1505150206264; Mon, 11 Sep 2017 10:16:46 -0700 (PDT) Received: from localhost ([2.25.234.0]) by smtp.gmail.com with ESMTPSA id e34sm11555780wre.15.2017.09.11.10.16.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2017 10:16:45 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Make more use of in_hard_reg_set_p Date: Mon, 11 Sep 2017 18:16:44 +0100 Message-ID: <87mv61cg03.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 An upcoming patch will convert hard_regno_nregs into an inline function, which in turn allows hard_regno_nregs to be used as the name of a targetm field. This patch rewrites a use that can use in_hard_reg_set_p instead. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. Also tested by comparing the testsuite assembly output on at least one target per CPU directory. OK to install? Richard 2017-09-11 Richard Sandiford gcc/ * ira-costs.c (record_operand_costs): Use in_hard_reg_set_p instead of hard_regno_nregs. Index: gcc/ira-costs.c =================================================================== --- gcc/ira-costs.c 2017-09-04 11:48:57.531552460 +0100 +++ gcc/ira-costs.c 2017-09-11 17:21:26.382315018 +0100 @@ -1386,7 +1386,7 @@ record_operand_costs (rtx_insn *insn, en cost_classes_t cost_classes_ptr = regno_cost_classes[regno]; enum reg_class *cost_classes = cost_classes_ptr->classes; reg_class_t rclass; - int k, nr; + int k; i = regno == (int) REGNO (src) ? 1 : 0; for (k = cost_classes_ptr->num - 1; k >= 0; k--) @@ -1398,18 +1398,9 @@ record_operand_costs (rtx_insn *insn, en { if (reg_class_size[rclass] == 1) op_costs[i]->cost[k] = -frequency; - else - { - for (nr = 0; - nr < hard_regno_nregs[other_regno][mode]; - nr++) - if (! TEST_HARD_REG_BIT (reg_class_contents[rclass], - other_regno + nr)) - break; - - if (nr == hard_regno_nregs[other_regno][mode]) - op_costs[i]->cost[k] = -frequency; - } + else if (in_hard_reg_set_p (reg_class_contents[rclass], + mode, other_regno)) + op_costs[i]->cost[k] = -frequency; } } }