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: why not consfold sin(const)


Robert Dewar wrote:

Of course in practice a constant like this will often be pulled
out of loops, CSE'ed etc, so the impact may be smaller than
expected.

In sensible languages for floating point computations, yes. One has to conclude, though, that floating point arithmetic was added as an afterthought to C - not surprising, given its initial niche.


All functions in <math.h> can set errno for domain and range errors; in other words, those functions are not pure, and cannot be moved out of loops or CSE'd away.

Obviously, with some effort it might be possible to get gcc to the point where it can prove for a set of useful constants that, e.g., sqrt cannot possibly have to set errno and that the call therefore might be assumed pure.

--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/


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