[GISel]: Add Pattern Matcher for G_FMUL.

https://reviews.llvm.org/D43206

llvm-svn: 325044
diff --git a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
index dd26e9b..dc41e54 100644
--- a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
@@ -201,6 +201,15 @@
   match = mi_match(MIBSub->getOperand(0).getReg(), MRI,
                    m_GSub(m_ICst(Cst), m_Reg(Src0)));
   ASSERT_FALSE(match);
+
+  auto MIBFMul = B.buildInstr(TargetOpcode::G_FMUL, s64, Copies[0],
+                              B.buildConstant(s64, 42));
+  // Match and test commutativity for FMUL.
+  match = mi_match(MIBFMul->getOperand(0).getReg(), MRI,
+                   m_GFMul(m_ICst(Cst), m_Reg(Src0)));
+  ASSERT_TRUE(match);
+  ASSERT_EQ(Cst, (uint64_t)42);
+  ASSERT_EQ(Src0, Copies[0]);
 }
 
 TEST(PatternMatchInstr, MatchExtendsTrunc) {