[PATCH] Fold isnan to UNORDERED_EXPR

Paolo Bonzini paolo.bonzini@polimi.it
Mon Jun 28 13:29:00 GMT 2004


This patch expand isnan(x) to UNORDERED_EXPR (x, x) at the tree level.
As a followup, I'll introduce folding UNORDERED_EXPR (x, x) ||
UNORDERED_EXPR (y, y) into UNORDERED_EXPR (x, y), and similarly for an
AND of two ORDERED_EXPRs.

Similar to what is done for isgreater and friends, isnan is declared as
a variadic function so that it can accept whatever floating-point type.

Indeed, waiting for Roger's restructuring of isgreater was useful, since
this patch is smaller and cleaner than my old one.

Bootstrapped/regtested i686-pc-linux-gnu, ok for mainline?

Paolo

2004-06-21  Paolo Bonzini  <bonzini@gnu.org>

	* builtins.c (fold_builtin_isnan): New.
	(fold_builtin_unordered_cmp): Fix commentary.
	(fold_builtin) <BUILTIN_ISNAN>: Call fold_builtin_isnan.
	* builtins.def (BUILTIN_ISNAN): New.

2004-06-21  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/builtins-43.c: New.




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: builtin-isnan.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040628/4478fd2e/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: builtins-43.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040628/4478fd2e/attachment.c>


More information about the Gcc-patches mailing list