[llvm] [llvm][AArch64] Fix an assertion message in TargetParserTests. NFC (PR #98085)
Jon Roelofs via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 8 14:59:51 PDT 2024
https://github.com/jroelofs created https://github.com/llvm/llvm-project/pull/98085
For both overloads, we were printing the bit-pattern for ExpectedFlags twice. While we're here, also add a convenience line that highlights the difference between the two sets.
>From 340a4df1129830c319b224a9ec40dffb0ba4cd50 Mon Sep 17 00:00:00 2001
From: Jon Roelofs <jonathan_roelofs at apple.com>
Date: Mon, 8 Jul 2024 14:53:30 -0700
Subject: [PATCH] [llvm][AArch64] Fix an assertion message in
TargetParserTests. NFC
For uint64_t flags, we were printing the bit-pattern for ExpectedFlags twice.
While we're here, also add a convenience line that highlights the difference
between the two sets.
---
llvm/unittests/TargetParser/TargetParserTest.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp
index 8231cfd2ad1c9..2689c8644331e 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -113,9 +113,11 @@ template <ARM::ISAKind ISAKind> struct AssertSameExtensionFlags {
return testing::AssertionFailure() << llvm::formatv(
"CPU: {4}\n"
"Expected extension flags: {0} ({1:x})\n"
- " Got extension flags: {2} ({3:x})\n",
+ " Got extension flags: {2} ({3:x})\n"
+ " Diff: {5} ({6:x})\n",
FormatExtensionFlags(ExpectedFlags), ExpectedFlags,
- FormatExtensionFlags(GotFlags), ExpectedFlags, CPUName);
+ FormatExtensionFlags(GotFlags), GotFlags, CPUName,
+ FormatExtensionFlags(ExpectedFlags ^ GotFlags));
}
testing::AssertionResult operator()(const char *m_expr, const char *n_expr,
@@ -127,11 +129,14 @@ template <ARM::ISAKind ISAKind> struct AssertSameExtensionFlags {
return testing::AssertionFailure()
<< llvm::formatv("CPU: {4}\n"
"Expected extension flags: {0} ({1})\n"
- " Got extension flags: {2} ({3})\n",
+ " Got extension flags: {2} ({3})\n"
+ " Diff: {5} ({6})\n",
FormatExtensionFlags(ExpectedFlags),
SerializeExtensionFlags(ExpectedFlags),
FormatExtensionFlags(GotFlags),
- SerializeExtensionFlags(ExpectedFlags), CPUName);
+ SerializeExtensionFlags(GotFlags), CPUName,
+ FormatExtensionFlags(ExpectedFlags ^ GotFlags),
+ SerializeExtensionFlags(ExpectedFlags ^ GotFlags));
}
private:
More information about the llvm-commits
mailing list