From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11574 invoked by alias); 20 Sep 2004 19:04:25 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11563 invoked from network); 20 Sep 2004 19:04:24 -0000 Received: from unknown (HELO caip.rutgers.edu) (128.6.236.10) by sourceware.org with SMTP; 20 Sep 2004 19:04:24 -0000 Received: from caip.rutgers.edu (localhost [127.0.0.1]) by caip.rutgers.edu (8.12.11/8.12.9) with ESMTP id i8KJ4NlE023925; Mon, 20 Sep 2004 15:04:23 -0400 (EDT) Received: (from ghazi@localhost) by caip.rutgers.edu (8.12.11/8.12.9/Submit) id i8KJ4Nwq023924; Mon, 20 Sep 2004 15:04:23 -0400 (EDT) Date: Mon, 20 Sep 2004 20:34:00 -0000 From: "Kaveh R. Ghazi" Message-Id: <200409201904.i8KJ4Nwq023924@caip.rutgers.edu> To: toon@moene.indiv.nluug.nl Subject: Re: why not consfold sin(const) Cc: dewar@gnat.com, gcc@gcc.gnu.org, l_belev@yahoo.com References: <20040919183425.53419.qmail@web52801.mail.yahoo.com> <414DD2E0.607@gnat.com> <414F21A0.4030101@moene.indiv.nluug.nl> X-SW-Source: 2004-09/txt/msg01183.txt.bz2 > From: Toon Moene > > > 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 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. If one uses -fno-math-errno, then sqrt is marked "pure". If you use -funsafe-math-optimizations then it is marked "const". (See comments in builtins.def for ATTR_MATHFN_FPROUNDING and ATTR_MATHFN_FPROUNDING_ERRNO.) The g77 frontend sets -fno-math-errno automatically, so I guess it's a "sensible" language. However I cannot find where (if) the new fortran frontend does it. So it remains to be seen whether that one is sensible or not. :-) You may want to check into that. --Kaveh -- Kaveh R. Ghazi ghazi@caip.rutgers.edu