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: 812458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-461840-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cKmjVDA9"; dkim-atps=neutral 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 3xrZNV05f6z9sBd for ; Tue, 12 Sep 2017 03:16:57 +1000 (AEST) 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=ELX8Q1jTD4XCmyjDpXuc/fdSLP+jY9th4D6voB0NZTdBoz/KejoHJ enwAbfi4j5kJVqzVw6A/hyU/fXt3VSay/bUXs1RVU1WunrgU3Vf830L0Que2eqAL G7IlMXvOwv31GBSyVPm2WFMNF8kZVxbzqQtzn+dD/9zdJbD56xihz0= 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=cKmjVDA9BIWXbc2Ez+Kg qqra3+RVF128lrMgxtG13AbGedbCBXc6fDq4KMtGboyCs3Olf2Ua5mrlg/Kg7S3z wWXOzLLlztwNjHXTss/f37CNIL1th/z8VtVQHqnIohRjQsEv0IVnTOh89Uphx5sH Ik20yD+tJzY9O1n/LzJLk8U= 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; } } }