On 9/20/23 11:12, Aldy Hernandez wrote:
In coming up with testcases for the unordered folders, I realized that
we were already handling them correctly, even in the absence of my
work in this area lately.

All of the unordered fold_range() methods try to fold with the ordered
variants first, and if they return TRUE, we are guaranteed to be able
to fold, even in the presence of NANs.  For example:

if (x_5 >= y_8)
   if (x_5 __UNLE y_8)

On the true side of the first conditional we know that either x_5 < y_8
or that one or more operands is a NAN.  Since UNLE_EXPR returns true
for precisely this scenario, we can fold as true.

Ugh, that should've been the false edge of the first conditional, thus:

if (x_5 >= y_8)
  {
  }
else
  {
    // Relation at this point is: x_5 < y_8
    // or either x_5 or y_8 is a NAN.
    if (x_5 __UNLE y_8)
      link_error();
  }

The second conditional is foldable because LT U NAN is a subset of __UNLE (which is LE U NAN).

The patch still stands though :).

Aldy

Reply via email to