From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26791 invoked by alias); 9 Jul 2010 00:04:58 -0000 Received: (qmail 26596 invoked by uid 48); 9 Jul 2010 00:04:44 -0000 Date: Fri, 09 Jul 2010 00:04:00 -0000 Message-ID: <20100709000444.26595.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/44883] Combine separate shift and add instructions into a single one In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "carrot at google dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg00948.txt.bz2 ------- Comment #2 from carrot at google dot com 2010-07-09 00:04 ------- (In reply to comment #1) > >So in function fwprop_addr before deciding propagate an expression should we > also check if it is the only use of the corresponding def? > > It does somewhat. Though address cost might be lower for r2+r3 than just r8. > Please make sure that fwprop_addr has the correct address cost. > It occurs before register allocation, it is hard to say (plus (reg 144) (reg 143)) is cheaper than (reg 137). But the address cost looks really strange. The arm/thumb2 address cost function is arm_arm_address_cost (rtx x) { enum rtx_code c = GET_CODE (x); if (c == PRE_INC || c == PRE_DEC || c == POST_INC || c == POST_DEC) return 0; if (c == MEM || c == LABEL_REF || c == SYMBOL_REF) return 10; if (c == PLUS) { if (GET_CODE (XEXP (x, 1)) == CONST_INT) return 2; if (ARITHMETIC_P (XEXP (x, 0)) || ARITHMETIC_P (XEXP (x, 1))) return 3; return 4; } return 6; } Give it a single register, the cost is 6. Give it the rtx (plus (reg 144) (reg 143)), the cost is 4. So a single register is more expensive than a plus expression, not reasonable. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44883