tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] tccgen.c: Optimise 0<<x, 0>>x, -1>>x, x&0, x


From: Edmund Grimley Evans
Subject: Re: [Tinycc-devel] [PATCH] tccgen.c: Optimise 0<<x, 0>>x, -1>>x, x&0, x*0, x|-1, x%1.
Date: Fri, 6 Mar 2015 08:11:39 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Vincent Lefevre <address@hidden>:

> > Do not optimise (0 / x) and (0 % x) here as x might be zero, though
> > for an architecture that does not generate an exception for division
> > by zero the back end might choose to optimise those.
> 
> When x is 0, this is undefined behavior, so that you are free to
> optimize them, even if the architecture generates an exception for
> division by 0. Contrary to IEEE 754, there isn't any requirement
> to generate an exception for integer operations.

Yes, I know, but I would nevertheless prefer (0 / x) to do the same
thing as (y / x) when both x and y are zero at run time. That
potentially depends on the target architecture.

Edmund



reply via email to

[Prev in Thread] Current Thread [Next in Thread]