[llvm] [APFloat] Correct semantics of minimum/maximum for signaling NaN arguments (PR #109976)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 06:37:38 PDT 2024
================
@@ -607,13 +607,16 @@ TEST(APFloatTest, Minimum) {
APFloat zp(0.0);
APFloat zn(-0.0);
APFloat nan = APFloat::getNaN(APFloat::IEEEdouble());
+ APFloat snan = APFloat::getSNaN(APFloat::IEEEdouble());
EXPECT_EQ(1.0, minimum(f1, f2).convertToDouble());
EXPECT_EQ(1.0, minimum(f2, f1).convertToDouble());
EXPECT_EQ(-0.0, minimum(zp, zn).convertToDouble());
EXPECT_EQ(-0.0, minimum(zn, zp).convertToDouble());
EXPECT_TRUE(std::isnan(minimum(f1, nan).convertToDouble()));
EXPECT_TRUE(std::isnan(minimum(nan, f1).convertToDouble()));
+ EXPECT_TRUE(maximum(snan, f1).isNaN());
+ EXPECT_FALSE(maximum(snan, f1).isSignaling());
----------------
arsenm wrote:
It is not required, but suggested you should try to preserve the payload of one of the input operands for nan producing operations
https://github.com/llvm/llvm-project/pull/109976
More information about the llvm-commits
mailing list