Converting floor to rint

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Nov 7 07:18:00 GMT 2002


Jan Hubicka <jh@suse.cz> writes:

[...]

| >        F.7.1  Environment management
| > 
| >        [#1]   IEC 60559  requires  that  floating-point  operations
| >        implicitly raise floating-point exception status flags,  and
| >        that  rounding control modes can be set explicitly to affect
| >        result values of floating-point operations.  When the  state
| >        for  the FENV_ACCESS pragma (defined in <fenv.h>) is ``on'',
| >        these changes to the floating-point  state  are  treated  as
| >        *side effects* which respect sequence points.304)
| > 
| > (my emphasis)
| 
| So one can not consider rint as "attribute((const))" function and we can
| not do that in strict mode.

That is exact.

| > 
| > | Otherwise, if
| > | __STDC_IEC_559__ is not defined, then no requirements on the exceptions
| > | are stated for rint, since 7.12.9.4 does not have a "shall".
| Can I detect somehow the cases when __STDC_IEC_559__ is not defined?

Also one would need to access thye value of FENV_ACCESS.  That is all
that I loosenely called "propriate FE exception machinary".

| This seems to be done by glibc in all cases, even with -ffast-math.
| Perhaps I can do the rint folding only with -ffast-math that would be
| enought for majority of 3D software that is about the only case where we
| get some oppurtunities for speedup from this transformations?

I won't oppose to having it in -funsafe-math.

-- Gaby



More information about the Gcc-patches mailing list