From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6994 invoked by alias); 23 Sep 2004 03:18:06 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6964 invoked by uid 48); 23 Sep 2004 03:18:05 -0000 Date: Thu, 23 Sep 2004 03:18:00 -0000 Message-ID: <20040923031805.6962.qmail@sourceware.org> From: "danglin at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040921015638.17578.danglin@gcc.gnu.org> References: <20040921015638.17578.danglin@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/17578] Missed optimization--failure of gcc.c-torture/execute/ieee/compare-fp-3.c at -O1 and above X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg02699.txt.bz2 List-Id: ------- Additional Comments From danglin at gcc dot gnu dot org 2004-09-23 03:17 ------- > > The generated code for this function is ok. It's just not optimized. > > As far as I can tell, neither comparison should trap, so -ftrapping-math > > shouldn't affect the optimization. > > I take this back. The compares can trap if x or y is a signalling NaN. > Thus, the compares can't be optimized without -fno-trapping-math. It seems that the default for flag_signaling_nans is 0. The equality and inequality operators are not supposed to trap on a quiet NaN. Thus, test1 should be optimized without the -fno-trapping_math option. See the node description for EQ_EXPR and NE_EXPR in doc/c-tree.texi. Currently, it is not being optimized at the tree level on either hppa-unknown-linux-gnu or i686-pc-linux-gnu. On the otherhand, LT_EXPR, LE_EXPR, GT_EXPR, GE_EXPR and possibly LTGT_EXPR can cause an invalid exception if one of the operands is a quiet NaN. Thus, the following two functions shouldn't be optimized without -fno-trapping_math: void test2 (float x, float y) { if ((xy)) link_error0(); } void test3 (float x, float y) { if ((x