Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #16785

Re: Optimisation questions

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 06 Feb 2012 18:10:38 -0600
Message-ID <4F306BFB.2561@mindspring.com> (permalink)
Date Mon, 06 Feb 2012 19:10:35 -0500
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: Optimisation questions
References <jgkbiu$432$1@speranza.aioe.org> <jgkfso$1bh$2@dont-email.me> <jgkgra$886$1@dont-email.me> <jgkou6$g96$1@dont-email.me> <20120205034114.797@kylheku.com> <jgpnon$qm7$1@dont-email.me>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 33
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.217.131
X-Trace sv3-JTM5rvWVK/cbQBbHLexMg7sZUr7xe/60vgo0vhTueNa96SHpbA1445cXuN7qUbc8LTree8DfQRTfxug!we2LUJvVt6CBWjCXkkU1KauQISPI5dKSaEwzETOJjF2lH6yDP8ha1ZZSJxq3f3uNooU7hBZt2ccs!1mhvFZXCL28=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2260
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:16785

Show key headers only | View raw


Stephen Sprunk wrote:
> 
> On 04-Feb-12 21:04, Kaz Kylheku wrote:
> > On 2012-02-05, James Kuyper <jameskuyper@verizon.net> wrote:
> >> On 02/04/2012 07:00 PM, Stephen Sprunk wrote:
> >>> On 04-Feb-12 17:44, James Kuyper wrote:
> >>>> As a general rule,
> >>>> your compiler should generate exactly the same code
> >>>> for x/8 and x>>3,
> >>>> because they're required to have exactly the same behavior.
> >>>
> >>> That only holds if x is non-negative.
> >>
> >> You're right
> >> - the result is implementation-defined if x is negative.
> >
> > Yes and the point is that this is what helps to optimize it better.
> 
> You missed the point.  If x is negative,
> they are not guaranteed to have the same behavior,
> so the compiler is not allowed to make such an optimization.  

I think Kaz was talking about a different optimization.

The value of (x>>3) being implementation defined 
for negative values of x,
suggests that the resulting opcodes for (x>>3)
should be simpler than they would be
if (x>>3) was defined as always being equal to (x/8).


-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Optimisation questions Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2012-02-04 22:30 +0000
  Re: Optimisation questions Ian Collins <ian-news@hotmail.com> - 2012-02-05 11:44 +1300
    Re: Optimisation questions Keith Thompson <kst-u@mib.org> - 2012-02-04 14:52 -0800
      Re: Optimisation questions Ian Collins <ian-news@hotmail.com> - 2012-02-05 11:55 +1300
      Re: Optimisation questions Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-02-21 18:41 +0200
  Re: Optimisation questions "BartC" <bc@freeuk.com> - 2012-02-04 22:44 +0000
    Re: Optimisation questions "BartC" <bc@freeuk.com> - 2012-02-04 23:41 +0000
  Re: Optimisation questions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-04 17:51 -0500
  Re: Optimisation questions Keith Thompson <kst-u@mib.org> - 2012-02-04 14:52 -0800
  Re: Optimisation questions James Kuyper <jameskuyper@verizon.net> - 2012-02-04 18:44 -0500
    Re: Optimisation questions Stephen Sprunk <stephen@sprunk.org> - 2012-02-04 18:00 -0600
      Re: Optimisation questions James Kuyper <jameskuyper@verizon.net> - 2012-02-04 21:18 -0500
        Re: Optimisation questions Kaz Kylheku <kaz@kylheku.com> - 2012-02-05 03:04 +0000
          Re: Optimisation questions Dann Corbit <dcorbit@connx.com> - 2012-02-06 09:40 -0800
            Re: Optimisation questions Willem <willem@toad.stack.nl> - 2012-02-06 18:51 +0000
            Re: Optimisation questions Markus Wichmann <nullplan@gmx.net> - 2012-02-07 14:19 +0100
              Re: Optimisation questions Dann Corbit <dcorbit@connx.com> - 2012-02-07 14:25 -0800
          Re: Optimisation questions Stephen Sprunk <stephen@sprunk.org> - 2012-02-06 17:29 -0600
            Re: Optimisation questions Kaz Kylheku <kaz@kylheku.com> - 2012-02-06 23:52 +0000
            Re: Optimisation questions pete <pfiland@mindspring.com> - 2012-02-06 19:10 -0500
    Re: Optimisation questions Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2012-02-05 10:51 +0000
      Re: Optimisation questions Ian Collins <ian-news@hotmail.com> - 2012-02-06 00:08 +1300
        Re: Optimisation questions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-05 08:13 -0500
      Re: Optimisation questions "BartC" <bc@freeuk.com> - 2012-02-05 11:33 +0000
      Re: Optimisation questions Zoltan Kocsi <zoltan@bendor.com.au> - 2012-02-05 23:24 +1100
        Re: Optimisation questions Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2012-02-05 22:28 +0000
          Re: Optimisation questions Kaz Kylheku <kaz@kylheku.com> - 2012-02-05 22:37 +0000
          Re: Optimisation questions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-05 17:48 -0500
          Re: Optimisation questions Keith Thompson <kst-u@mib.org> - 2012-02-05 15:57 -0800
      Re: Optimisation questions "BartC" <bc@freeuk.com> - 2012-02-05 12:53 +0000
  Re: Optimisation questions Geoff <geoff@invalid.invalid> - 2012-02-04 16:07 -0800
  Re: Optimisation questions "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-02-04 15:37 -0800
    Re: Optimisation questions Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-05 04:26 -0800
      Re: Optimisation questions lawrence.jones@siemens.com - 2012-02-07 10:56 -0500
  Re: Optimisation questions Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-05 04:29 -0800
  Re: Optimisation questions Michael Angelo Ravera <maravera@prodigy.net> - 2012-02-05 23:24 -0800

csiph-web