This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Mined out of comp.std.c...
- From: Nathan Sidwell <nathan at acm dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc at gcc dot gnu dot org, Jan Hubicka <jh at suse dot cz>
- Date: Thu, 25 Apr 2002 09:46:36 +0100
- Subject: Re: Mined out of comp.std.c...
- References: <20020425065117.GJ26266@codesourcery.com> <20020425011127.C2022@redhat.com>
- Reply-to: nathan at compsci dot bristol dot ac dot uk
Richard Henderson wrote:
>
> On Wed, Apr 24, 2002 at 11:51:17PM -0700, Zack Weinberg wrote:
> > More interesting to me is the observation that - since we know the
> > arithmetic properties of the target - we could transform
> > ((a > b) ? a : b) into the above, if it were a win. What I'm
> > wondering is if it is.
this optimization is relying on sign (b - a) indicating the truthfulness
of a > b. That is not correct, as b - a might overflow. For instance
a = 7fffffff (most pos), b=80000000 (most neg).
a is most definitely > b, but b - a will be 1 (or some overflow trap)
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
The voices in my head told me to say this
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk