public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "PHHargrove at lbl dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/31557] return 0x80000000UL code gen can be improved
Date: Tue, 14 Aug 2012 00:31:00 -0000	[thread overview]
Message-ID: <bug-31557-4-z4pEzs4dpZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-31557-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Paul H. Hargrove <PHHargrove at lbl dot gov> 2012-08-14 00:31:14 UTC ---
(In reply to comment #3)
> FWIW, 4.8.0 20120809 w/ -O1 or higher is now using just 4 instructions instead
> of 5.  So, "half way there".
> 
> 
> .L.f:
>         lis 3,0x8000
>         ori 3,3,1
>         rldicl 3,3,0,32
>         blr

That was for a 64-bit target, where the need to zero the upper half of r3
(which is 0xffffffff due to sign extension of 0x8000 by 'lis') accounts for the
4th instruction.  So, there is still room for improvement using the originally
proposed 3-instruction sequence (since 'oris' won't sign-extend as 'lis' does).


For a 32-bit target, it appears that GCC 4.8.0 20120809 has reached the desired
three instructions:

f:
        lis 3,0x8000
        ori 3,3,1
        blr


  parent reply	other threads:[~2012-08-14  0:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-31557-4@http.gcc.gnu.org/bugzilla/>
2012-08-13 23:03 ` PHHargrove at lbl dot gov
2012-08-14  0:31 ` PHHargrove at lbl dot gov [this message]
2024-03-05  0:16 ` bergner at gcc dot gnu.org
2024-03-05  0:20 ` pinskia at gcc dot gnu.org
2007-04-12 21:10 [Bug target/31557] New: " pinskia at gcc dot gnu dot org
2007-07-02 21:35 ` [Bug target/31557] " pinskia at gcc dot gnu dot org
2009-05-14  5:19 ` bje 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-31557-4-z4pEzs4dpZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).