summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/CodeGen')
-rw-r--r--llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
index dd26e9b11fe..dc41e5425d4 100644
--- a/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
+++ b/llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp
@@ -201,6 +201,15 @@ TEST(PatternMatchInstr, MatchBinaryOp) {
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) {
OpenPOWER on IntegriCloud