From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10443 invoked by alias); 6 Nov 2002 18:09:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10434 invoked from network); 6 Nov 2002 18:09:38 -0000 Received: from unknown (HELO mx2.redhat.com) (12.150.115.133) by sources.redhat.com with SMTP; 6 Nov 2002 18:09:38 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.11.6/8.11.6) with ESMTP id gA6I7xP15870; Wed, 6 Nov 2002 13:07:59 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gA6I9Vl15371; Wed, 6 Nov 2002 13:09:31 -0500 Received: from localhost.localdomain (frothingslosh.sfbay.redhat.com [172.16.24.27]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id gA6I9UD18197; Wed, 6 Nov 2002 10:09:30 -0800 Received: (from rth@localhost) by localhost.localdomain (8.11.6/8.11.6) id gA6I9Um22081; Wed, 6 Nov 2002 10:09:30 -0800 X-Authentication-Warning: localhost.localdomain: rth set sender to rth@redhat.com using -f Date: Wed, 06 Nov 2002 10:09:00 -0000 From: Richard Henderson To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, aj@suse.de Subject: Re: Simplify floating point conversions II Message-ID: <20021106180930.GA22066@redhat.com> Mail-Followup-To: Richard Henderson , Jan Hubicka , gcc-patches@gcc.gnu.org, aj@suse.de References: <20021105171400.GX14655@kam.mff.cuni.cz> <20021105173800.GD20534@redhat.com> <20021106092310.GE22059@kam.mff.cuni.cz> <20021106175441.GZ22059@kam.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021106175441.GZ22059@kam.mff.cuni.cz> User-Agent: Mutt/1.4i X-SW-Source: 2002-11/txt/msg00296.txt.bz2 On Wed, Nov 06, 2002 at 06:54:41PM +0100, Jan Hubicka wrote: > + For fast math it would be safe probably to convert (float)sqrt(x) > + into sqrt((float)x), but in strict mode the argument can overflow. */ I don't believe this to be true. > + /* Wind away possible cast. */ > + if (TREE_CODE (arg0) == NOP_EXPR) > + arg0 = TREE_OPERAND (arg0, 0); Why would you do this? This might be casting down to double from long double. You should only strip casts when they widen the type. > + /* convert (outertype)((innertype0)a+(innertype1)b) > + into ((newtype)a+(newtype)b) where newtype > + is the widest mode from all of these. */ This changes overflow characteristics of +. Consider (double)((float)a + (float)b) where A = B = 2**127. The result should be +Inf, not 2**128. Finally, I think it is alarmingly incorrect that (float)((double)a + (double)b)) does not result in a quantity of type float, as requested. r~