From patchwork Wed Mar 27 06:49:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Lee X-Patchwork-Id: 231601 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 CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id CCB5B2C009B for ; Wed, 27 Mar 2013 17:49:45 +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:date :message-id:from:to:subject:reply-to:mime-version:content-type; q=dns; s=default; b=KF3K4IsgPoz1u8Qn3GrFz9X9twPCpoQArGrBKsiD8QD qrtQX/GtAZmwlVMyWomh1GMqltLsoWjPvg1fg+Co2Vpu1qDPyv3q2tvQRYSNze8E xVbwS7raxzziL4eviITsYndl0tnZhqLA2BliIuHS/yXaZ1ZWbWjY5lqwvQqhmBJE = 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:date :message-id:from:to:subject:reply-to:mime-version:content-type; s=default; bh=eTuOr3jW/9rXDcF4a8phX+7I45w=; b=kf59QaG/r1/whiKy8 ysgpWyqZCt031k7cNpipAR5A5kD9ZpeqGSGMCkBLkGlFAQ7ErbX6/v9oy6JWbtLc Glj+uh3pSYxLRhZx5v/v999mnEMSKGywpQ00kc4dcuNFV1BTL+6ySeaGgvlz2W0z ZqfIDKGac43WrIY150zbd1lbHU= Received: (qmail 23773 invoked by alias); 27 Mar 2013 06:49:35 -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 23743 invoked by uid 89); 27 Mar 2013 06:49:28 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from usmamail.tilera.com (HELO USMAMAIL.TILERA.COM) (12.216.194.151) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 27 Mar 2013 06:49:26 +0000 Received: from farm-0001.internal.tilera.com (10.2.0.31) by USMAEXCH2.tad.internal.tilera.com (10.3.0.33) with Microsoft SMTP Server (TLS) id 14.0.722.0; Wed, 27 Mar 2013 02:49:23 -0400 Received: (from walt@localhost) by farm-0001.internal.tilera.com (8.14.4/8.12.11/Submit) id r2R6nNIA008433; Wed, 27 Mar 2013 02:49:23 -0400 Date: Wed, 27 Mar 2013 02:49:23 -0400 Message-ID: <201303270649.r2R6nNIA008433@farm-0001.internal.tilera.com> From: Walter Lee To: Subject: [committed] TILE-Gx: fix prologue register usage Reply-To: Walter Lee MIME-Version: 1.0 This patch fixes a bug that causes the prologue to use more temporary registers than necessary. Backported to 4.7 and 4.8. * config/tilegx/tilegx.c (tilegx_expand_prologue): Avoid double-decrement of next_scratch_regno. --- gcc/config/tilegx/tilegx.c (revision 197134) +++ gcc/config/tilegx/tilegx.c (working copy) @@ -3999,11 +3999,10 @@ tilegx_expand_prologue (void) if (r == NULL_RTX) { - rtx p = compute_frame_addr (offset, &next_scratch_regno); - r = gen_rtx_REG (Pmode, next_scratch_regno--); - reg_save_addr[which_scratch] = r; - - emit_insn (gen_rtx_SET (VOIDmode, r, p)); + int prev_scratch_regno = next_scratch_regno; + r = compute_frame_addr (offset, &next_scratch_regno); + if (prev_scratch_regno != next_scratch_regno) + reg_save_addr[which_scratch] = r; } else {