public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm@polyomino.org.uk>
To: Jie Zhang <zhangjie@magima.com.cn>
Cc: gcc@gcc.gnu.org
Subject: Re: A question about integer promotion in GCC
Date: Thu, 02 Sep 2004 08:19:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0409020811190.26807@digraph.polyomino.org.uk> (raw)
In-Reply-To: <4136D20A.7010609@magima.com.cn>

On Thu, 2 Sep 2004, Jie Zhang wrote:

> According to this, shouldn't it be:
> 
>     return (int)x << 8 | (int)x >> 8;
> 
> Maybe it has no performance benefit. But it make the tree dump result
> conforming to the standard and improve the readability of the final assembly
> output when being compiled using -O2 option. How about your thoughts?

The current function of tree dumps is for debugging the compiler, not as a 
representation of source.  Various optimisations are performed on the 
trees generated, both in the process of generating them to avoid 
generating unnecessary garbage, and as part of fold(), before they get to 
the first tree dumps.  (In this case, a right shift of a short can be 
represented directly on the short, whereas a left shift of a short 
cannot.)

There is a mood towards doing less such optimisations at parse time (and 
generally reducing the front end / middle end overlap), in particular 
reducing parse-time folding to constant folding only and causing the 
remaining optimisations fold() does to be done later on GIMPLE.  This is 
however a substantial task to do while being sure that each change is an 
incremental improvement that does not cause regressions, as every useful 
transformation fold() does would need implementing at a later stage, and 
the result would need careful checking to be sure that all such 
transformations had been properly implemented, before any can be removed 
from fold().

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 3.5
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

  parent reply	other threads:[~2004-09-02  8:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-02  7:56 Jie Zhang
2004-09-02  8:09 ` Jie Zhang
2004-09-02  8:19 ` Joseph S. Myers [this message]
2004-09-03  8:33   ` Jie Zhang
2004-09-06  8:01   ` Nathan Sidwell
2004-09-06  8:43     ` Joseph S. Myers
2004-09-06  8:52       ` Nathan Sidwell
2004-09-06  9:01         ` Joseph S. Myers
2004-09-06  9:54           ` Nathan Sidwell
2004-09-06 11:59             ` Joseph S. Myers

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=Pine.LNX.4.61.0409020811190.26807@digraph.polyomino.org.uk \
    --to=jsm@polyomino.org.uk \
    --cc=gcc@gcc.gnu.org \
    --cc=zhangjie@magima.com.cn \
    /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).