summaryrefslogtreecommitdiff
path: root/gcc/doc/c-tree.texi
diff options
context:
space:
mode:
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-28 16:37:08 +0000
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-28 16:37:08 +0000
commit318a728f904732ccea8f616d2694af282ccfc848 (patch)
tree7ddeb479040eb4166d908a90967e3c0027eb6800 /gcc/doc/c-tree.texi
parentcdf460bd0fc42b4da0b4a3b46cba3dfaf6940e11 (diff)
downloadgcc-318a728f904732ccea8f616d2694af282ccfc848.tar.gz
gcc/ChangeLog:
2004-05-27 Paolo Bonzini <bonzini@gnu.org> Roger Sayle <roger@eyesopen.com> PR rtl-optimization/15649 Add LTGT_EXPR and improve pretty-printing of unordered comparisons. * c-common.c (c_common_truthvalue_conversion): Handle LTGT_EXPR. * c-typeck.c (build_binary_op): Likewise. * dojump.c (do_jump): Likewise. * expr.c (expand_expr_real_1, do_store_flag): Likewise. * predict.c (tree_predict_by_opcode): Likewise. * real.c (real_compare): Likewise. * tree-cfg.c (verify_expr): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. Handle ORDERED_EXPR, UNORDERED_EXPR. (op_symbol): Print unordered comparisons differently than ordered ones. * tree.def (LTGT_EXPR): New '<' tree code. * doc/c-tree.texi (Expressions): Document floating-point comparison nodes. Fold comparisons between floating point values. * fold-const.c (enum comparison_code): New, from #define'd constants. Define compcodes for unordered comparisons and for invalid transformations. (invert_tree_comparison): Add "honor_nans" parameter. (fold_truthop): Revamp to work on floating-point types too. (comparison_to_compcode): Support unordered comparisons. Use new enum comparison_code. (compcode_to_comparison): Likewise. (combine_compcodes): New function. (invert_truthvalue): Let invert_tree_comparison decide whether it is valid to fold the comparison. Fold ORDERED and UNORDERED even if flag_unsafe_math_optimizations is off, and the remaining even if flag_unsafe_math_optimizations is off but we are under -fno-trapping-math. (fold_relational_const): Integer modes do not honor NaNs. gcc/testsuite/ChangeLog: 2004-05-27 Paolo Bonzini <bonzini@gnu.org> * gcc.c-torture/compare-fp-1.c, gcc.c-torture/compare-fp-2.c, gcc.c-torture/compare-fp-3.c, gcc.c-torture/compare-fp-4.c, gcc.c-torture/compare-fp-3.x, gcc.c-torture/compare-fp-4.x, gcc.c-torture/pr15649-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82365 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/c-tree.texi')
-rw-r--r--gcc/doc/c-tree.texi39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index d99c568380d..0e0b1af5c74 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -1745,6 +1745,12 @@ This macro returns the attributes on the type @var{type}.
@tindex GE_EXPR
@tindex EQ_EXPR
@tindex NE_EXPR
+@tindex UNLT_EXPR
+@tindex UNLE_EXPR
+@tindex UNGT_EXPR
+@tindex UNGE_EXPR
+@tindex UNEQ_EXPR
+@tindex LTGT_EXPR
@tindex INIT_EXPR
@tindex MODIFY_EXPR
@tindex COMPONENT_REF
@@ -2106,6 +2112,39 @@ operators. The first and second operand with either be both of integral
type or both of floating type. The result type of these expressions
will always be of integral or boolean type.
+Floating-point comparison may have a fourth possible outcome for a
+comparison, other than less, greater or equal: this is @dfn{unordered},
+and two floating-point values are unordered if one of them is
+a @dfn{not-a-number} (@dfn{NaN}) value. In this case, all of these
+nodes will be false but @code{NE_EXPR}, and the first four of these
+nodes will also raise an invalid operation trap.
+
+@item ORDERED_EXPR
+@itemx UNORDERED_EXPR
+@item UNLT_EXPR
+@itemx UNLE_EXPR
+@itemx UNGT_EXPR
+@itemx UNGE_EXPR
+@itemx UNEQ_EXPR
+@itemx LTGT_EXPR
+
+These nodes represent other relational operations that are only used
+with floating types.
+
+If the outcome of the comparison is unordered, all of these special
+comparisons will be true but @code{ORDERED_EXPR} and @code{LTGT_EXPR}.
+Only @code{LTGT_EXPR} is expected to generate an invalid floating-point
+operation trap when the outcome is unordered.
+
+@code{ORDERED_EXPR} is true if neither of its operands is a NaN,
+while its negation @code{UNORDERED_EXPR} is true if at least one of
+its operands is a NaN.
+
+For floating operations, inverting one of the standard comparison nodes
+will result in one of these nodes, with its name prefixed by
+@code{UN}---the only exception is @code{NE_EXPR}, whose negation is
+@code{LTGT_EXPR}.
+
@item MODIFY_EXPR
These nodes represent assignment. The left-hand side is the first
operand; the right-hand side is the second operand. The left-hand side