public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Schlie <schlie@comcast.net>
To: <gcc@gcc.gnu.org>
Subject: Re: question about ashlqi3 pattern
Date: Fri, 26 Nov 2004 00:05:00 -0000	[thread overview]
Message-ID: <BDCBD49F.80FB%schlie@comcast.net> (raw)

> Balaji S wrote:
>
> When I rebuilt GCC and tried with the following test case,
> *does not* giving me an *rtl with byte* (QI) shift operation.
> ..
> char a, b ;
> void fn1 () { a = b << 1 ; }
>
> Pls. help me, Why am i not getting a byte QI left shift?

Likely because GCC tends to initially literally promote all operands as
specified by C evaluation rules without consideration of the operations
true target precision requirements prior to attempting to determine if
the applied promotions were actually necessary based on modular arithmetic;
resulting in circumstances where the prematurely applied promotion obscure
their own ability to be subsequently reliably identified as being
unnecessary.

Which tends to have negligible effect on machines who's word-size is int or
wider, as by default, operands are effectively promoted to the machine's
word size (being int or wider) as a consequence of being loaded into the
register file by default; but for smaller machines, or those which may
benefit from inhibiting the promotion of operands to being no wider than
necessary, GCC's present promotion strategy tends to be less than optimal.
As for example, your code's specified operation is promoted to int precision
as literally specified by C, although not logically required to be, as the
un-promoted operation yields equivalent results as a consequence of the of
the operations specified target precision is only a char wide regardless of
it being signed or unsigned.

Therefore you may need to try to specify templates in your .md to identify
opportunities to nullify otherwise needlessly promoted operations/operands
occasionally preserved by GCC's front/middle ends if you can want to take
advantage of alternative less aggressively promoted equivalent evaluation
forms.


             reply	other threads:[~2004-11-25 23:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-26  0:05 Paul Schlie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-25 14:20 Uros Bizjak
2004-11-25 12:44 Balaji S

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=BDCBD49F.80FB%schlie@comcast.net \
    --to=schlie@comcast.net \
    --cc=gcc@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).