From patchwork Tue Nov 22 12:41:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 697694 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tNQ8p19wfz9srZ for ; Tue, 22 Nov 2016 23:42:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rxzmnPlx"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:cc:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=aoTdVFKOBCV41/a+VuKuJtYv3Yfp8yxmiYj0f7IK0bA7287FA1 2u1g16c7qh52xY9WrMj0oF7f8NlgJaBfQFgkwmjEAQ7S+6rlHRTS+EDegmP17oAl qQkqT+oPIWZDFglkpieM0RobdL6JrQuSFgez7pJteffnX7jQqVZQc5QaM= 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:cc:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=MzLum8HDjOUAVYgveC/leWTr6Aw=; b=rxzmnPlxUZQVtvSsyAa4 FEtN9TmVqBC/ATBuRRQDwEYrmVtGHcYuS5LOmnPIin+XHIzUhsaYC12nD1NbsBbd wwu8U1ihSJpVs4OgxTJwrEponUSXzh2UhJolPwM7QCgQ4S4owqbdDuowvpJtzrKF iOQKY1pN2osWVqtcStlQ5sM= Received: (qmail 115710 invoked by alias); 22 Nov 2016 12:42:09 -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 114352 invoked by uid 89); 22 Nov 2016 12:42:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Hx-languages-length:1928, csp, wr, UD:r X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.162) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Nov 2016 12:41:57 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwR/bcHRirORRW3yMcVao= X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (mail.hightec-rt.com [213.135.1.215]) by smtp.strato.de (RZmta 39.9 DYNA|AUTH) with ESMTPSA id n0741csAMCftFm4 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 22 Nov 2016 13:41:55 +0100 (CET) Cc: Denis Chertykov To: gcc-patches From: Georg-Johann Lay Subject: [patch,avr] Fix PR60300: Minor prologue improvement. Message-ID: Date: Tue, 22 Nov 2016 13:41:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes This patch is a minor improvement of prologue length. It now allows frame sizes of up to 11 to be allocated by RCALL + PUSH 0 sequences but limits the number of RCALLs to 3. The PR has some discussion on size vs. speed consideration w.r. to using RCALL in prologues, and following that I picked the rather arbitrary upper bound of 3 RCALLs. The prior maximal frame size opt to such sequences was 6 which also never produced more than 3 RCALLs. Ok for trunk? Johann gcc/ PR target/60300 * config/avr/constraints.md (Csp): Widen range to [-11..6]. * config/avr/avr.c (avr_prologue_setup_frame): Limit number of RCALLs in prologue to 3. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 242672) +++ config/avr/avr.c (working copy) @@ -1687,7 +1687,11 @@ avr_prologue_setup_frame (HOST_WIDE_INT /* Stack adjustment by means of RCALL . and/or PUSH __TMP_REG__ can only handle specific offsets. */ - if (avr_sp_immediate_operand (gen_int_mode (-size, HImode), HImode)) + int n_rcall = size / (AVR_3_BYTE_PC ? 3 : 2); + + if (avr_sp_immediate_operand (gen_int_mode (-size, HImode), HImode) + // Don't use more than 3 RCALLs. + && n_rcall <= 3) { rtx_insn *sp_plus_insns; Index: config/avr/constraints.md =================================================================== --- config/avr/constraints.md (revision 242671) +++ config/avr/constraints.md (working copy) @@ -189,9 +189,9 @@ (define_constraint "Cx4" (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<8))"))) (define_constraint "Csp" - "Integer constant in the range -6 @dots{} 6." + "Integer constant in the range -11 @dots{} 6." (and (match_code "const_int") - (match_test "IN_RANGE (ival, -6, 6)"))) + (match_test "IN_RANGE (ival, -11, 6)"))) (define_constraint "Cxf" "32-bit integer constant where at least one nibble is 0xf."