From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16180 invoked by alias); 31 Mar 2011 18:31:56 -0000 Received: (qmail 16166 invoked by uid 22791); 31 Mar 2011 18:31:54 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 Mar 2011 18:31:49 +0000 Received: (qmail 3037 invoked from network); 31 Mar 2011 18:31:49 -0000 Received: from unknown (HELO ?192.168.1.66?) (vries@127.0.0.2) by mail.codesourcery.com with ESMTPA; 31 Mar 2011 18:31:49 -0000 Message-ID: <4D94C88B.4020206@codesourcery.com> Date: Thu, 31 Mar 2011 18:35:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org, ebotcazou@libertysurf.fr CC: Maxim Kuvyrkov , Bernd Schmidt Subject: [PATCH, PR43920, 4-9/9] Cross-jumping. References: <4D94C603.7080505@codesourcery.com> In-Reply-To: <4D94C603.7080505@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg02247.txt.bz2 The impact of patches 4-9 of the patch set on the example from the bug report for ARM Thumb-2 -Os is a further size reduction of 7%, from 58 to 54 bytes. This size reduction is illustrated in this diff of the assembly (left, without patches, size 58. right, with patches, size 54): ... push {r3, r4, r5, r6, r7, push {r3, r4, r5, r6, r7, mov r7, r1 mov r7, r1 mov r6, r2 mov r6, r2 movs r1, #0 movs r1, #0 movs r2, #1 movs r2, #1 mov r5, r0 mov r5, r0 bl lseek bl lseek movs r1, #0 movs r1, #0 movs r2, #2 movs r2, #2 mov r4, r0 mov r4, r0 mov r0, r5 mov r0, r5 bl lseek bl lseek adds r2, r4, #1 adds r2, r4, #1 beq .L3 | beq .L5 adds r3, r0, #1 adds r3, r0, #1 beq .L2 beq .L2 subs r0, r0, r4 subs r0, r0, r4 beq .L5 beq .L5 str r4, [r7, #0] str r4, [r7, #0] str r0, [r6, #0] str r0, [r6, #0] movs r0, #0 movs r0, #0 pop {r3, r4, r5, r6, r7, pop {r3, r4, r5, r6, r7, .L3: < mov r0, r4 < pop {r3, r4, r5, r6, r7, < .L5: .L5: mov r0, #-1 mov r0, #-1 .L2: .L2: pop {r3, r4, r5, r6, r7, pop {r3, r4, r5, r6, r7, ... The patches 4-9 allows crossjumping: - to recognize that 'mov r0, r4' and 'move r0, #-1' have the same effect, and - to extend the search scope past label .L2 backward to .L5, in order to recognize that the jump to .L3 can be replaced with a jump to .L5. Thanks, - Tom