[Bug java/17731] New: sub-optimal code generated for left shift
tromey at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 29 17:58:00 GMT 2004
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
More information about the Java-prs
mailing list