public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/17731] New: sub-optimal code generated for left shift
@ 2004-09-29 17:58 tromey at gcc dot gnu dot org
  2004-09-29 18:05 ` [Bug java/17731] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-09-29 17:58 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <bug-17731-8172@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-05-22 15:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-29 17:58 [Bug java/17731] New: sub-optimal code generated for left shift tromey at gcc dot gnu dot org
2004-09-29 18:05 ` [Bug java/17731] " pinskia at gcc dot gnu dot org
2004-09-29 18:09 ` tromey at gcc dot gnu dot org
2004-09-29 18:11 ` pinskia at gcc dot gnu dot org
2004-09-29 18:14 ` [Bug target/17731] " pinskia at gcc dot gnu dot org
2004-09-29 18:16 ` pinskia at gcc dot gnu dot org
2004-09-29 19:39 ` [Bug rtl-optimization/17731] " rth at gcc dot gnu dot org
2004-09-29 21:03 ` tromey at gcc dot gnu dot org
     [not found] <bug-17731-8172@http.gcc.gnu.org/bugzilla/>
2011-05-22 15:52 ` steven at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).