From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16273 invoked by alias); 22 May 2011 15:52:24 -0000 Received: (qmail 16249 invoked by uid 22791); 22 May 2011 15:52:24 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 May 2011 15:52:10 +0000 From: "steven at gcc dot gnu.org" To: java-prs@gcc.gnu.org Subject: [Bug rtl-optimization/17731] sub-optimal code generated for left shift X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: steven at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed Resolution Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sun, 22 May 2011 15:52:00 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org X-SW-Source: 2011-q2/txt/msg00038.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17731 Steven Bosscher changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Last reconfirmed|2006-01-16 06:19:32 |2011-05-22 17:27:32 Resolution| |FIXED --- Comment #8 from Steven Bosscher 2011-05-22 15:30:58 UTC --- (In reply to comment #2) > Yes, that's fine. > The java front end generates trees like >. > I would like the extra "and" to be optimized out somewhere > along the way, on a target-specific basis. Fixed by tree-ssa:: $ cat t.c int shift (int x, int y) { int _y = y & 31; return x << _y; } $ ./cc1 -quiet -m32 -O2 t.c -fdump-tree-optimized $ cat t.s .file "t.c" .text .p2align 4,,15 .globl shift .type shift, @function shift: .LFB0: .cfi_startproc movl 4(%esp), %eax movl 8(%esp), %ecx sall %cl, %eax ret .cfi_endproc .LFE0: .size shift, .-shift .ident "GCC: (GNU) 4.6.0 20110312 (experimental) [trunk revision 170907]" .section .note.GNU-stack,"",@progbits