From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19511 invoked by alias); 29 Sep 2004 17:58:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19488 invoked by uid 48); 29 Sep 2004 17:58:04 -0000 Date: Wed, 29 Sep 2004 17:58:00 -0000 From: "tromey at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20040929175802.17731.tromey@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/17731] New: sub-optimal code generated for left shift X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg03670.txt.bz2 List-Id: Consider this java method: public int shift (int x, int y) { return x << y; } On x86, with -O3, this becomes: _ZN1t5shiftEii: .LFB2: pushl %ebp .LCFI0: movl %esp, %ebp .LCFI1: movl 16(%ebp), %ecx movl 12(%ebp), %eax popl %ebp andl $31, %ecx sall %cl, %eax ret However, on x86 (starting with 80286), the shift count is masked to 5 bits by sall, so the "andl" instruction is redundant. I haven't looked to see exactly where this buglet might lie. -- Summary: sub-optimal code generated for left shift Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tromey at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17731