[cfe-commits] Patch for evaluating FP constant expressions

Neil Booth neil at daikokuya.co.uk
Thu Nov 29 14:42:29 PST 2007

Christopher Lamb wrote:-

> On Nov 29, 2007, at 7:04 AM, Neil Booth wrote:
> > Christopher Lamb wrote:-
> >
> >> I needed this to support negation of FP literals, which is pretty
> >> unambiguous. It looks like GCC evaluates more complex constant
> >> expressions too, so I put in support for some of that (though
> >> rounding mode is an issue). All of this is modeled on the work for
> >> integer expressions and uses APFloat.
> >
> > Why compare results to opOK?
> I assumed that if there were a problem evaluating the expression that  
> it'd be good to check for that. Why not compare results to opOK?

Do you understand the meaning of the various return values?  They are
documented in the header, and should make sense with a bit of an FP
background.  I don't see why you shouldn't always fold regardless of
the return value in almost all cases.

Are you intending to not fold 1.1 * 1.1? It will not return opOK.
Also 1.0 / 0.0 will not return opOK, but will give infinity value,
which I suspect is what you want.  Just two examples.


More information about the cfe-commits mailing list