Before I commit this, or do the corresponding tree level patch, I would like this to be looked at by the FP people. I am guessing at some of this, other parts i gleaned from various standards docs and an irc conversation with Joseph. This should have been documented when it was put into the compiler. This is certainly not obvious.

Kenny
Index: gcc/doc/rtl.texi
===================================================================
--- gcc/doc/rtl.texi	(revision 220541)
+++ gcc/doc/rtl.texi	(working copy)
@@ -2553,40 +2553,52 @@ of comparisons is supported on a particu
 pass will try to merge the operations to produce the @code{eq} shown
 in case it exists in the context of the particular insn involved.
 
-Inequality comparisons come in two flavors, signed and unsigned.  Thus,
-there are distinct expression codes @code{gt} and @code{gtu} for signed and
-unsigned greater-than.  These can produce different results for the same
-pair of integer values: for example, 1 is signed greater-than @minus{}1 but not
-unsigned greater-than, because @minus{}1 when regarded as unsigned is actually
+Fixed point inequality comparisons come in two flavors, signed and
+unsigned.  Thus, there are distinct expression codes @code{gt} and
+@code{gtu} for signed and unsigned greater-than.  These can produce
+different results for the same pair of integer values: for example, 1
+is signed greater-than @minus{}1 but not unsigned greater-than,
+because @minus{}1 when regarded as unsigned is actually
 @code{0xffffffff} which is greater than 1.
 
-The signed comparisons are also used for floating point values.  Floating
-point comparisons are distinguished by the machine modes of the operands.
+Floating point comparisons come in two flavors, signaling and quiet,
+though these are not always paired.  The fixed point signed
+comparisons are also used for floating point comparisons.  Floating
+point comparisons are distinguished by the machine modes of the
+operands.
 
 @table @code
 @findex eq
 @cindex equal
 @item (eq:@var{m} @var{x} @var{y})
-@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
-are equal, otherwise 0.
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are equal, otherwise 0.  If the operands are floating point,
+this is a quiet comparison and corresponds to the IEC 60559
+@code{compareQuietEqual} operation.
 
 @findex ne
 @cindex not equal
 @item (ne:@var{m} @var{x} @var{y})
-@code{STORE_FLAG_VALUE} if the values represented by @var{x} and @var{y}
-are not equal, otherwise 0.
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are not equal, otherwise 0. If the operands are floating
+point, this is a quiet comparison and corresponds to the IEC 60559
+@code{compareQuietNotEqual} operation.
 
 @findex gt
 @cindex greater than
 @item (gt:@var{m} @var{x} @var{y})
-@code{STORE_FLAG_VALUE} if the @var{x} is greater than @var{y}.  If they
-are fixed-point, the comparison is done in a signed sense.
+@code{STORE_FLAG_VALUE} if the @var{x} is greater than @var{y}.  If
+the operands are fixed-point, the comparison is done in a signed
+sense.  If the operands are floating point, this is a signaling
+comparison and corresponds to the IEC 60559
+@code{compareSignalingGreater} operation.
 
 @findex gtu
 @cindex greater than
 @cindex unsigned greater than
 @item (gtu:@var{m} @var{x} @var{y})
-Like @code{gt} but does unsigned comparison, on fixed-point numbers only.
+Like @code{gt} but does unsigned comparison, on fixed-point numbers
+only.  This is undefined for floating point numbers.
 
 @findex lt
 @cindex less than
@@ -2594,7 +2606,10 @@ Like @code{gt} but does unsigned compari
 @cindex unsigned less than
 @item (lt:@var{m} @var{x} @var{y})
 @itemx (ltu:@var{m} @var{x} @var{y})
-Like @code{gt} and @code{gtu} but test for ``less than''.
+Like @code{gt} and @code{gtu} but test for ``less than''. If the
+operands are floating point, @code{gt} is a signaling comparison and
+corresponds to the IEC 60559 @code{compareSignalingLess} operation.
+@code{gtu} is undefined for floating point numbers.
 
 @findex ge
 @cindex greater than
@@ -2603,6 +2618,10 @@ Like @code{gt} and @code{gtu} but test f
 @item (ge:@var{m} @var{x} @var{y})
 @itemx (geu:@var{m} @var{x} @var{y})
 Like @code{gt} and @code{gtu} but test for ``greater than or equal''.
+If the operands are floating point, @code{ge} is a signaling
+comparison and corresponds to the IEC 60559
+@code{compareSignalingGreater} operation.  @code{geu} is undefined for
+floating point numbers.
 
 @findex le
 @cindex less than or equal
@@ -2610,7 +2629,64 @@ Like @code{gt} and @code{gtu} but test f
 @cindex unsigned less than
 @item (le:@var{m} @var{x} @var{y})
 @itemx (leu:@var{m} @var{x} @var{y})
-Like @code{gt} and @code{gtu} but test for ``less than or equal''.
+Like @code{gt} and @code{gtu} but test for ``less than or equal''.  If
+the operands are floating point, @code{le} is a signaling comparison
+and corresponds to the IEC 60559 @code{compareSignalingLess}
+operation.  @code{leu} is undefined for floating point numbers.
+
+@table @code
+@findex unlt
+@cindex unordered less than
+@item (unlt:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are less or unordered, otherwise 0.  This is a quiet operation
+that applies only to floating point operands and corresponds to the
+IEC 60559 @code{compareQuietLessUnordered} operation.
+
+@table @code
+@findex unle
+@cindex unordered less equal
+@item (unle:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are less, equal, or unordered, otherwise 0.  This is a quiet
+operation that applies only to floating point operands and corresponds
+to the IEC 60559 @code{compareQuietNotGreater} operation.
+
+@table @code
+@findex ltgt
+@cindex less than or greater than
+@item (ltgt:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are less, or greater, otherwise 0.  This is a quiet operation
+that applies only to floating point operands and does not have a
+corresponding IEC 60559 operation.
+
+@table @code
+@findex uneq
+@cindex unordered or equal
+@item (uneq:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by @var{x} and
+@var{y} are unordered or equal, otherwise 0.  This is a quiet
+operation that applies only to floating point operands and does not
+have a corresponding IEC 60559 operation.
+
+@table @code
+@findex ordered
+@cindex less equal or greater
+@item (ordered:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by both @var{x} and
+@var{y} are not nan, otherwise 0.  This is a quiet operation that
+applies only to floating point operands and corresponds to the IEC
+60559 @code{compareQuietOrdered} operation.
+
+@table @code
+@findex unordered
+@cindex is a nan
+@item (unordered:@var{m} @var{x} @var{y})
+@code{STORE_FLAG_VALUE} if the values represented by either @var{x}
+and either @var{y} are nan, otherwise 0.  This is a quiet operation
+that applies only to floating point operands and corresponds to the
+IEC 60559 @code{compareQuietUnordered} operation.
 
 @findex if_then_else
 @item (if_then_else @var{cond} @var{then} @var{else})

Reply via email to