From patchwork Sat Jun 23 12:38:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitar Dimitrov X-Patchwork-Id: 933707 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-480370-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="mVAZOo7n"; 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 41CZkk5WQ6z9s2L for ; Sat, 23 Jun 2018 22:39:25 +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:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=MTKJqozZJ30G6d3mFUDEPc+5+3aA45fEMya6ZftGI5uEhK9mT/9k9 81KEaEEv5mPEWn/eMcqmRH5FUZ/hfhbZdewAoM5lKVhR3/vTf7Qfqyd9jTSmCZRN aJoO1lt+dMDJrBtCXT7ljZH5iBniCGRlmNFtYxeWn8npSe9EhxwwpI= 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:cc:subject:date:message-id:in-reply-to:references; s= default; bh=Z2bAYkU0BnGZGHrIWxC35aE3B7g=; b=mVAZOo7nhn7WaN9nDGqO fAcm7Nzld8NkPzmOasIWbKoPf9SNJ6my//dowwfmmcHI8+O5CRNy43lBP0IqXmKq ubDpS4WlBoq3X/viT+YTJLCSn4F4FFT/wn7r4S2nUJTbiApkqM2VVqKCv/C+ZS1l rQIfgrBtNv8zHIcphakzfuM= Received: (qmail 128010 invoked by alias); 23 Jun 2018 12:39:17 -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 128001 invoked by uid 89); 23 Jun 2018 12:39:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2562 X-HELO: spamexpert01-s28.outgoing.host.bg Received: from spamexpert01-s28.outgoing.host.bg (HELO spamexpert01-s28.outgoing.host.bg) (217.174.156.200) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Jun 2018 12:39:15 +0000 Received: from server28.host.bg ([193.107.36.199]) by spamexpert01.outgoing.host.bg with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fWhoq-0008CQ-NB; Sat, 23 Jun 2018 15:39:10 +0300 Received: from [95.87.234.74] (port=46544 helo=localhost.localdomain) by server28.host.bg with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1fWhoo-008wh2-EQ; Sat, 23 Jun 2018 15:39:06 +0300 From: Dimitar Dimitrov To: gcc-patches@gcc.gnu.org Cc: Dimitar Dimitrov , Vladimir Makarov , Peter Bergner , Kenneth Zadeck , Seongbae Park , Jeff Law Subject: [PATCH v2] Fix LRA to handle multi-word eliminable registers Date: Sat, 23 Jun 2018 15:38:59 +0300 Message-Id: <20180623123859.30728-1-dimitar@dinux.eu> In-Reply-To: <6030066.Yf38S1ALNg@tpdeb> References: <6030066.Yf38S1ALNg@tpdeb> X-AuthUser: dimitar@dinux.eu X-SpamExperts-Domain: server28.host.bg X-SpamExperts-Username: 193.107.36.199 Authentication-Results: outgoing.host.bg; auth=pass smtp.auth=193.107.36.199@server28.host.bg X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00427993720052) X-Recommended-Action: accept X-Report-Abuse-To: spam@spamexpert01.outgoing.host.bg X-IsSubscribed: yes For some targets, Pmode != UNITS_PER_WORD. Take this into account when marking hard registers as being used. I tested C and C++ testsuits for x86_64 with and without this patch. There was no regression, i.e. gcc.sum and g++.sum matched exactly. Changes since patch series v1: - Cleanup to use add_to_hard_reg_set. - Also fix check_pseudos_live_through_calls. - Decouple PRU tests so that LRA patch is now standalone. gcc/ChangeLog: 2018-06-23 Dimitar Dimitrov * lra-eliminations.c (update_reg_eliminate): Mark all spanning hard registers for Pmode.. * lra-lives.c (check_pseudos_live_through_calls): Mark all spanning hard registers for the clobbered pseudo. Cc: Vladimir Makarov Cc: Peter Bergner Cc: Kenneth Zadeck Cc: Seongbae Park Cc: Jeff Law Signed-off-by: Dimitar Dimitrov --- gcc/lra-eliminations.c | 4 ++-- gcc/lra-lives.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c index 21d8d5f8018..f5f104020b3 100644 --- a/gcc/lra-eliminations.c +++ b/gcc/lra-eliminations.c @@ -1264,13 +1264,13 @@ update_reg_eliminate (bitmap insns_with_changed_offsets) CLEAR_HARD_REG_SET (temp_hard_reg_set); for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) if (elimination_map[ep->from] == NULL) - SET_HARD_REG_BIT (temp_hard_reg_set, ep->from); + add_to_hard_reg_set (&temp_hard_reg_set, Pmode, ep->from); else if (elimination_map[ep->from] == ep) { /* Prevent the hard register into which we eliminate from the usage for pseudos. */ if (ep->from != ep->to) - SET_HARD_REG_BIT (temp_hard_reg_set, ep->to); + add_to_hard_reg_set (&temp_hard_reg_set, Pmode, ep->to); if (maybe_ne (ep->previous_offset, ep->offset)) { bitmap_ior_into (insns_with_changed_offsets, diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index 588bc09cb8e..920fd02b997 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -581,7 +581,8 @@ check_pseudos_live_through_calls (int regno, for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++) if (targetm.hard_regno_call_part_clobbered (hr, PSEUDO_REGNO_MODE (regno))) - SET_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, hr); + add_to_hard_reg_set (&lra_reg_info[regno].conflict_hard_regs, + PSEUDO_REGNO_MODE (regno), hr); lra_reg_info[regno].call_p = true; if (! sparseset_bit_p (pseudos_live_through_setjumps, regno)) return;