This is the mail archive of the gcc-patches@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]

[PATCH] Improve PR28796 (inconsistend __builtin_nan() and __builtin_unordered()) further


simplify-rtx.c currently guards constant folding of ORDERED and
UNORDERED on flag_unsafe_math_optimizations.  Better use !HONOR_NANS
here, as the code does for other transformations as well.

Queued for 4.3, or maybe obvious enough for 4.2 if we enter generic
bug-fixing mode again.

Richard.


2006-08-25  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28796
	* simplify-rtx.c (simplify_const_relational_operation):
	Do not constant-fold ORDERED and UNORDERED for
	flag_unsafe_math_optimizations but only we do not need to
	honor NaNs for the given mode.

Index: simplify-rtx.c
===================================================================
*** simplify-rtx.c	(revision 116373)
--- simplify-rtx.c	(working copy)
*************** simplify_const_relational_operation (enu
*** 3748,3757 ****
      return simplify_const_relational_operation (signed_condition (code),
  						mode, tem, const0_rtx);
  
!   if (flag_unsafe_math_optimizations && code == ORDERED)
      return const_true_rtx;
  
!   if (flag_unsafe_math_optimizations && code == UNORDERED)
      return const0_rtx;
  
    /* For modes without NaNs, if the two operands are equal, we know the
--- 3748,3757 ----
      return simplify_const_relational_operation (signed_condition (code),
  						mode, tem, const0_rtx);
  
!   if (! HONOR_NANS (mode) && code == ORDERED)
      return const_true_rtx;
  
!   if (! HONOR_NANS (mode) && code == UNORDERED)
      return const0_rtx;
  
    /* For modes without NaNs, if the two operands are equal, we know the


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