From mboxrd@z Thu Jan 1 00:00:00 1970 From: tlaronde@polynum.com Date: Wed, 21 Apr 2010 22:19:46 +0200 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-ID: <20100421201946.GA424@polynum.com> References: <20100421134019.GA1382@polynum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Subject: Re: [9fans] Integer arithmetic: some lessons Topicbox-Message-UUID: 0b858902-ead6-11e9-9d60-3106f5b1d025 On Wed, Apr 21, 2010 at 11:03:06AM -0400, geoff@plan9.bell-labs.com wrote: > If you think that shift operators aren't being translated > to shift instructions, you can examine the output of 8c -S. > > x/2 is equal to x>>1 for non-negative integer x; for negative x, > the two expressions may yield different values, even if > x is a signed integer. The book Hacker's Delight, among others, > explores these sorts of optimisations. Thanks for the reference. Having spent 3 days trying to understand "generally" what was going on, I will now isolate one drawing that leads to problem and add trace for gcc and for ken-cc to see where they do not compute the same values. This will narrow the things and assembly, on this, will give clues. -- Thierry Laronde http://www.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C