Add constant folding rules for floating-point comparison
This change handles all 6 regular comparison types in two variations, ordered (true if values are ordered *and* comparison is true) and unordered (true if values are unordered *or* comparison is true). Ordered comparison matches the default floating-point behavior on host but we use std::isnan to check ordering explicitly anyway. This change also slightly reworks the floating-point folding support code to make it possible to define a folding operation that returns boolean instead of floating point. These tests exhaustively test ordered/unordered comparisons for float/double. Since for NaN inputs the comparison result doesn't depend on the comparison function, we just test == and !=; NaN inputs result in true unordered comparisons and false ordered comparisons.
Loading
Please register or sign in to comment