public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* why not consfold sin(const)
@ 2004-09-19 16:02 Luchezar Belev
  2004-09-19 18:00 ` Robert Dewar
  0 siblings, 1 reply; 23+ messages in thread
From: Luchezar Belev @ 2004-09-19 16:02 UTC (permalink / raw)
  To: gcc

Hi all,

when compiling with -ffast-math, gcc replaces sin(0) with 0, but does not const fold sin of any
other const.
Is there some problem with that in principle (like that would not be correct code in some
circumstances)
or it's just not implemented?
This is also true for other builtin math funcs like log() (gcc only optimizes log(1) to 0),
but it is not the case with sqrt() - in that case the compiler always constfolds and eliminates
the
expensive and redundant sqrt operation.

Lucho



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: why not consfold sin(const)
@ 2004-09-23 11:35 Bradley Lucier
  2004-09-23 23:04 ` Toon Moene
  0 siblings, 1 reply; 23+ messages in thread
From: Bradley Lucier @ 2004-09-23 11:35 UTC (permalink / raw)
  To: Toon Moene; +Cc: Bradley Lucier, gcc

Re:

> 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.

Which is one reason to have -fno-math-errno (which is part of 
-ffast-math).

Brad

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2004-09-23 20:04 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-19 16:02 why not consfold sin(const) Luchezar Belev
2004-09-19 18:00 ` Robert Dewar
2004-09-19 19:17   ` Luchezar Belev
2004-09-19 19:31     ` Robert Dewar
2004-09-19 19:55       ` Luchezar Belev
2004-09-19 20:25         ` Robert Dewar
2004-09-19 20:34           ` Luchezar Belev
2004-09-19 20:56             ` Zack Weinberg
2004-09-20  8:15               ` Kai Henningsen
2004-09-19 21:12             ` Robert Dewar
2004-09-19 20:53           ` Timothy J.Wood
2004-09-19 22:41             ` Robert Dewar
2004-09-20  0:31               ` Timothy J.Wood
2004-09-20  4:27                 ` Robert Dewar
2004-09-20  5:44                   ` Dale Johannesen
2004-09-20 19:43       ` Toon Moene
2004-09-20 20:34         ` Kaveh R. Ghazi
2004-09-20 23:31         ` Robert Dewar
2004-09-21  0:13         ` Scott Robert Ladd
2004-09-21  5:18           ` Steven Bosscher
2004-09-21  5:55             ` Scott Robert Ladd
2004-09-23 11:35 Bradley Lucier
2004-09-23 23:04 ` Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).