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: Vincent Lefevre
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:29:06 +0100
User-agent: Mutt/1.5.23-6424-vl-r76280 (2015-02-19)

On 2015-03-05 22:09:22 +0000, Edmund Grimley Evans wrote:
> 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.

-- 
Vincent Lefèvre <address@hidden> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

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