From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25886 invoked by alias); 11 Aug 2010 15:19:14 -0000 Received: (qmail 24408 invoked by uid 48); 11 Aug 2010 15:18:39 -0000 Date: Wed, 11 Aug 2010 15:19:00 -0000 Subject: [Bug tree-optimization/45256] New: Missed arithmetic simplification at tree level X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bernds at gcc dot gnu dot org" 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-08/txt/msg00853.txt.bz2 I'll attach a testcase, which shows a missed simplification at tree level: D.2276_42 = i_53 + 1; D.2277_43 = D.2276_42 * 32; iftmp.3_55 = __fswab32 (xb_54); __asm__("clz %0, %1" : "=r" ret_56 : "r" iftmp.3_55 : "cc"); ret_58 = 32 - ret_56; ret_59 = D.2277_43 - ret_58; In effect, the constant 32 is both added and subtracted from the result. With a four-insn combiner, this is caught at the RTL stage (compiling for Thumb-1): - add r2, r2, #1 lsl r2, r2, #5 - add r3, r3, r2 - sub r3, r3, #32 + add r3, r2, r3 -- Summary: Missed arithmetic simplification at tree level Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bernds at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: arm-none-linux-gnueabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45256