This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mined out of comp.std.c...


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]