From patchwork Wed Aug 3 23:01:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 108330 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]) by ozlabs.org (Postfix) with SMTP id ECC9CB71F2 for ; Thu, 4 Aug 2011 09:01:35 +1000 (EST) Received: (qmail 1834 invoked by alias); 3 Aug 2011 23:01:33 -0000 Received: (qmail 1826 invoked by uid 22791); 3 Aug 2011 23:01:32 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Aug 2011 23:01:14 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p73N1E8q018978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Aug 2011 19:01:14 -0400 Received: from anchor.twiddle.net (vpn-228-63.phx2.redhat.com [10.3.228.63]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p73N1DMJ023323; Wed, 3 Aug 2011 19:01:13 -0400 Message-ID: <4E39D339.1030008@redhat.com> Date: Wed, 03 Aug 2011 16:01:13 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: GCC Patches CC: chertykov@gmail.com, avr@gjlay.de Subject: [AVR] Fix target/34888 X-IsSubscribed: yes 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 When a frame pointer is in use, we can optimize popping all queued parameters via a simple move from the frame pointer instead of an addition to the stack pointer. The new sequence is 4 insns, the old sequence was 9 insns. Committed. r~ PR target/34888 * config/avr/avr.md: New splitter for REG_ARGS_SIZE 0. diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index b8560df..b5aa73c 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -235,6 +235,17 @@ DONE; }) +;; Notice a special-case when adding N to SP where N results in a +;; zero REG_ARGS_SIZE. This is equivalent to a move from FP. +(define_split + [(set (reg:HI REG_SP) (match_operand:HI 0 "register_operand" ""))] + "reload_completed + && frame_pointer_needed + && !cfun->calls_alloca + && find_reg_note (insn, REG_ARGS_SIZE, const0_rtx)" + [(set (reg:HI REG_SP) (reg:HI REG_Y))] + "") + ;;======================================================================== ;; move byte ;; The last alternative (any immediate constant to any register) is