In IEEE-754 [0], the description implies that isless
and other “quiet comparison” operations (isgreater
, isgreatequal
, …) still raises an exception.
In C standard 7.12.14.3 [1], it describes how isless
does not raise any exception for unordered operands…
The isless macro determines whether its first argument is less than its second argument. The value of isless(x, y) is always equal to (x) < (y); howev er, unlike (x) < (y), isless(x, y) does not raise the ‘‘invalid’’ floating-point exception when x and y are unordered.
Also in C standard F.2.1 [1], it explicitly states that signaling NaNs are not included in it.
This specification does not define the behavior of signaling NaNs.346)
I guess this gives us a conclusion of the following (O
stands for raise exception, X
stands for don’t raise exception)
| sNaN | qNaN
----------------------------
isless(x, y) | O | X
----------------------------
raw op `<` | O | O
[0] Quoting from IEEE-754, “the unordered-quiet reversed predicate (X ?>= Y) is different in that it does not signal an invalid operation exception when X and Y are unordered (unless X or Y is a signaling NaN).”
[1] C11 standard https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf
Should the FIXME [2] under CGBuiltin.cpp be removed then? Since we “should” trap on sNaN for isless
?
[2] https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGBuiltin.cpp#L2979