public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kevin Lawton <kevinlawton2001@yahoo.com>
To: Robert Dewar <dewar@gnat.com>, gcc@gcc.gnu.org
Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
Date: Fri, 11 Oct 2002 15:12:00 -0000	[thread overview]
Message-ID: <20021011202232.85226.qmail@web80303.mail.yahoo.com> (raw)
In-Reply-To: <20021011190858.BB0D0F2DF6@nile.gnat.com>


--- Robert Dewar <dewar@gnat.com> wrote:
> <<But I don't know of any way to tell the compiler to _not_ generate
> a bounds check on the switch variable 'byte'.  All of the target
> space is covered.
> 
> To solve this, could we add an attribute to switch?
> 
>   switch (byte) __attribute (( no-bounds-check )) {
>     ...
>     }
> >>
> 
> Surely this is NOT the solution in a case when it is obvious that no
> check is needed. We have noticed this junk check being a problem in
> GNAT, and what we do is to turn the last case into a default, but this
> of course is definitely not optimial.


It may not always be easy for the compiler to know.  If GCC
could eliminate the unnecessary check for the obvious cases,
that'd be great.

But such an attribute (or whatever method you propose) is needed
when the programmer knows more about the data flow than the
compiler.  Which for high performance programs, tends to be
quite a few.

I haven't tried turning the last case into the default, but I
can't see how that eliminates a check, so I'm not clear on the
win there.

-Kevin

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

  reply	other threads:[~2002-10-11 20:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11 13:22 Robert Dewar
2002-10-11 15:12 ` Kevin Lawton [this message]
2002-10-12 10:43   ` Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2002-10-16  9:19 Robert Dewar
2002-10-15 22:40 Robert Dewar
2002-10-15 23:57 ` Zack Weinberg
2002-10-15  6:43 Mattias Engdegård
2002-10-11 13:20 Kevin Lawton
2002-10-12  4:18 ` Ralph Loader
2002-10-14  8:31 ` Richard Zidlicky
2002-10-14 10:09   ` Dale Johannesen
2002-10-14 21:11 ` Jamie Lokier
2002-10-14 22:01   ` Zack Weinberg
2002-10-15  8:12     ` Michael Matz
2002-10-15 19:15       ` Zack Weinberg
2002-10-15 19:18         ` Dale Johannesen
2002-10-16 14:07           ` Richard Henderson
2002-10-15 21:16         ` Kevin Lawton
2002-10-15 23:40           ` Tim Hollebeek
2002-10-16  3:40             ` Michael Matz
2002-10-16 13:38               ` Tim Hollebeek
2002-10-16 14:23                 ` Michael Matz
2002-10-16 13:27             ` Hartmut Schirmer
2002-10-16  3:25         ` Joseph S. Myers
2002-10-16  7:57           ` Fergus Henderson
2002-10-16 11:19           ` Daniel Jacobowitz
2002-10-15  7:54   ` Michael Matz
2002-10-15 13:29     ` Jamie Lokier
2002-10-15 14:06       ` Kevin Lawton
2002-10-15 15:32         ` Jamie Lokier
2002-10-15 14:28       ` Michael Matz
2002-10-15 15:19         ` Jamie Lokier

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=20021011202232.85226.qmail@web80303.mail.yahoo.com \
    --to=kevinlawton2001@yahoo.com \
    --cc=dewar@gnat.com \
    --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).