public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug rtl-optimization/17731] sub-optimal code generated for left shift
Date: Sun, 22 May 2011 15:52:00 -0000	[thread overview]
Message-ID: <bug-17731-8172-rKFbGEMA2i@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-17731-8172@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17731

Steven Bosscher <steven at gcc dot gnu.org> 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 <steven at gcc dot gnu.org> 2011-05-22 15:30:58 UTC ---
(In reply to comment #2)
> Yes, that's fine.
> The java front end generates trees like <shift op <and op 31>>.
> 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


       reply	other threads:[~2011-05-22 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-17731-8172@http.gcc.gnu.org/bugzilla/>
2011-05-22 15:52 ` steven at gcc dot gnu.org [this message]
2004-09-29 17:58 [Bug java/17731] New: " tromey 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17731-8172-rKFbGEMA2i@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).