[llvm-exegesis] Fix failing assert when creating Snippet for LAHF.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48123

llvm-svn: 334599
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
index 0e4a3fb..d020d4c 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
@@ -103,11 +103,22 @@
 
   const unsigned Opcode = llvm::X86::CMP64rr;
   auto Conf = checkAndGetConfiguration(Opcode);
-  EXPECT_THAT(Conf.Info, testing::HasSubstr("cycle through CMOVLE16rr"));
+  EXPECT_THAT(Conf.Info, testing::HasSubstr("cycle through"));
   ASSERT_THAT(Conf.Snippet, testing::SizeIs(2));
+  const llvm::MCInst Instr = Conf.Snippet[0];
+  EXPECT_THAT(Instr.getOpcode(), Opcode);
   // TODO: check that the two instructions alias each other.
 }
 
+TEST_F(LatencySnippetGeneratorTest, LAHF) {
+  const unsigned Opcode = llvm::X86::LAHF;
+  auto Conf = checkAndGetConfiguration(Opcode);
+  EXPECT_THAT(Conf.Info, testing::HasSubstr("cycle through"));
+  ASSERT_THAT(Conf.Snippet, testing::SizeIs(2));
+  const llvm::MCInst Instr = Conf.Snippet[0];
+  EXPECT_THAT(Instr.getOpcode(), Opcode);
+}
+
 class UopsSnippetGeneratorTest : public X86SnippetGeneratorTest {
 protected:
   UopsSnippetGeneratorTest() : Runner(State) {}