From 97e0ec9c6448f6cdf6e5b1b8dd803960b6171894 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Jun 2026 11:16:33 -0500 Subject: [PATCH 1/2] [NFC] Improve logging on mismatched values This change is just intended to improve the logging for mismatched values by logging the specific value that mismatched (helpful for large comparison buffers) and printing floathex or hex depending on of the value is a floating point type. --- lib/Support/Check.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/Support/Check.cpp b/lib/Support/Check.cpp index b685fe2e9..f4ab9cac4 100644 --- a/lib/Support/Check.cpp +++ b/lib/Support/Check.cpp @@ -19,6 +19,7 @@ #include #include #include +#include constexpr uint16_t Float16BitSign = 0x8000; constexpr uint16_t Float16BitExp = 0x7c00; @@ -178,11 +179,24 @@ static bool testAll(std::function ComparisonFn, if (Arr1.size() != Arr2.size()) return false; + bool Passed = true; for (size_t I = 0, E = Arr1.size(); I < E; ++I) { - if (!ComparisonFn(Arr1[I], Arr2[I])) - return false; + if (!ComparisonFn(Arr1[I], Arr2[I])) { + std::ostringstream ActStr, ExpStr; + if constexpr (std::is_floating_point_v) { + ActStr << Arr1[I] << " (" << std::hexfloat << Arr1[I] << ")"; + ExpStr << Arr2[I] << " (" << std::hexfloat << Arr2[I] << ")"; + } else { + ActStr << "0x" << std::hex << Arr1[I]; + ExpStr << "0x" << std::hex << Arr2[I]; + } + llvm::errs() << " Mismatch at element " << I + << ": expected=" << ExpStr.str() + << ", actual=" << ActStr.str() << "\n"; + Passed = false; + } } - return true; + return Passed; } template From 2f59943dc1243aab5bbb2c1a30e12d16c1d71820 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Jun 2026 11:24:01 -0500 Subject: [PATCH 2/2] clang-format --- lib/Support/Check.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Support/Check.cpp b/lib/Support/Check.cpp index f4ab9cac4..f9b94a783 100644 --- a/lib/Support/Check.cpp +++ b/lib/Support/Check.cpp @@ -191,8 +191,8 @@ static bool testAll(std::function ComparisonFn, ExpStr << "0x" << std::hex << Arr2[I]; } llvm::errs() << " Mismatch at element " << I - << ": expected=" << ExpStr.str() - << ", actual=" << ActStr.str() << "\n"; + << ": expected=" << ExpStr.str() + << ", actual=" << ActStr.str() << "\n"; Passed = false; } }