From patchwork Thu Oct 31 16:01:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 287537 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1344E2C03DB for ; Fri, 1 Nov 2013 03:02:01 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=SoSDNhXRWu92R0v4YphXaqtjDPvCfSo3fgNYPsuPMIf 4PC0EBYRPE/90IVF3CvhL5Lk9YydyJBZxl8EeJtnejHSN2dltUTT6JvqWSdQlyGT i/hR9DEmAaK8b8XZ08jIWjtK9nAMdljiVfeAMqpwjE3UkRy29nEDoCOsjVZcws6s = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=SUyT/w18gkOITDKulMfJ0kxTGFo=; b=mlTnTGuLY7iBHHpE1 cQlkVNA/6tE7+BIsgzpSihOMGNHp5PUd4ct8jjJZhxl7t/MHcwSeNQcxMovfSFai WtEEC8XnVwq2p43Yh7/oS/Epzo+PFs2HO/YYrycH1IH3J726EuTrZ0kgjq6aLumw asN45CbzWzmkvvlxmXP3IkIOhA= Received: (qmail 32290 invoked by alias); 31 Oct 2013 16:01:54 -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 32278 invoked by uid 89); 31 Oct 2013 16:01:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Oct 2013 16:01:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9VG1pPf030792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 31 Oct 2013 12:01:52 -0400 Received: from topor.usersys.redhat.com ([10.15.16.142]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9VG1oYJ017470; Thu, 31 Oct 2013 12:01:50 -0400 Message-ID: <52727EEE.7040808@redhat.com> Date: Thu, 31 Oct 2013 12:01:50 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: gcc-patches CC: Matthew Fortune Subject: patch to fix mips16 LRA register shuffling X-IsSubscribed: yes The following patch fixes a problem reported by Matt Fortune. LRA generated additional moves for frame pointer eliminated into stack pointer. LRA uses register number of the elimination result when matching constraints. But it did not substitute RTL operand itself and that resulted in EXTRA_CONSTRAINT hooks failure and worse code generation. The patch was bootstrapped on x86/x86-64 and ppc64 (with LRA). Committed as rev. 204267. 2013-10-31 Vladimir Makarov * lra-constraints (process_alt_operands): Use the result elimination register for operand when matching constraints. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 204245) +++ lra-constraints.c (working copy) @@ -1466,23 +1466,32 @@ function. */ for (nop = 0; nop < n_operands; nop++) { + rtx reg; + op = no_subreg_reg_operand[nop] = *curr_id->operand_loc[nop]; /* The real hard regno of the operand after the allocation. */ hard_regno[nop] = get_hard_regno (op); - operand_reg[nop] = op; - biggest_mode[nop] = GET_MODE (operand_reg[nop]); - if (GET_CODE (operand_reg[nop]) == SUBREG) + operand_reg[nop] = reg = op; + biggest_mode[nop] = GET_MODE (op); + if (GET_CODE (op) == SUBREG) { - operand_reg[nop] = SUBREG_REG (operand_reg[nop]); + operand_reg[nop] = reg = SUBREG_REG (op); if (GET_MODE_SIZE (biggest_mode[nop]) - < GET_MODE_SIZE (GET_MODE (operand_reg[nop]))) - biggest_mode[nop] = GET_MODE (operand_reg[nop]); + < GET_MODE_SIZE (GET_MODE (reg))) + biggest_mode[nop] = GET_MODE (reg); } - if (REG_P (operand_reg[nop])) - no_subreg_reg_operand[nop] = operand_reg[nop]; + if (! REG_P (reg)) + operand_reg[nop] = NULL_RTX; + else if (REGNO (reg) >= FIRST_PSEUDO_REGISTER + || ((int) REGNO (reg) + == lra_get_elimination_hard_regno (REGNO (reg)))) + no_subreg_reg_operand[nop] = reg; else - operand_reg[nop] = NULL_RTX; + operand_reg[nop] = no_subreg_reg_operand[nop] + /* Just use natural mode for elimination result. It should + be enough for extra constraints hooks. */ + = regno_reg_rtx[hard_regno[nop]]; } /* The constraints are made of several alternatives. Each operand's