From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32216 invoked by alias); 10 Aug 2011 11:20:22 -0000 Received: (qmail 32206 invoked by uid 22791); 10 Aug 2011 11:20:21 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Aug 2011 11:20:07 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qr6pR-00037I-43 for gcc@gcc.gnu.org; Wed, 10 Aug 2011 13:20:05 +0200 Received: from 193.128.72.68 ([193.128.72.68]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Aug 2011 13:20:05 +0200 Received: from paulo by 193.128.72.68 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Aug 2011 13:20:05 +0200 To: gcc@gcc.gnu.org From: "Paulo J. Matos" Subject: Move insn out of the way Date: Wed, 10 Aug 2011 11:20:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00202.txt.bz2 Hi, I am having a size optimisation issue with GCC-4.6.1. The problem boils down to the fact that I have no idea on the best way to hint to GCC that a given insn would make more sense someplace else. The C code is simple: int16_t mask(uint32_t a) { return (x & a) == a; } int16_t is QImode and uint32_t is HImode. After combine the insn chain (which is unmodified all the way to ira) is (in simplified form): regQI 27 <- regQI AH [a] regQI 28 <- regQI AL [a+1] regQI AL <- andQI(regQI 28, memQI(symbolrefQI(x) + 1)) regQI AH <- andQI(regQI 27, memQI(symbolrefQI(x)) regQI 30 <- regQI AL regQI 29 <- regQI AH regQI 24 <- 1 if regQI 29 != regQI 27 goto labelref 20 if regQI 30 != regQI 28 goto labelref 20 goto labelref 22 labelref 20 regQI 24 <- 0 labelref 22 regQI AL <- regQI 24 The problem resides in `regQI 24 <- 1' being before the jumps. Since regQI 24 is going to AL, IRA decides to allocate regQI 24 to AL, which creates loads of conflicts and reloads. If that same insn would be moved to after the jumps and before the `goto labelref 22' then all would be fine cause by then regs 27, 28, 29, 30 are dead. It's obviously hard to point to a solution but I was wondering if there's a way to hint to GCC that moving an insn might help the code issue. Or if I should look into a why an existing pass is not already doing that. Cheers, -- PMatos