forked from OSchip/llvm-project
GlobalISel: Add matcher for G_SHL
This commit is contained in:
parent
d15723ef06
commit
cce3d96bcc
|
@ -241,6 +241,12 @@ inline BinaryOp_match<LHS, RHS, TargetOpcode::G_OR, true> m_GOr(const LHS &L,
|
|||
return BinaryOp_match<LHS, RHS, TargetOpcode::G_OR, true>(L, R);
|
||||
}
|
||||
|
||||
template <typename LHS, typename RHS>
|
||||
inline BinaryOp_match<LHS, RHS, TargetOpcode::G_SHL, false>
|
||||
m_GShl(const LHS &L, const RHS &R) {
|
||||
return BinaryOp_match<LHS, RHS, TargetOpcode::G_SHL, false>(L, R);
|
||||
}
|
||||
|
||||
template <typename LHS, typename RHS>
|
||||
inline BinaryOp_match<LHS, RHS, TargetOpcode::G_LSHR, false>
|
||||
m_GLShr(const LHS &L, const RHS &R) {
|
||||
|
|
|
@ -137,6 +137,14 @@ TEST_F(AArch64GISelMITest, MatchBinaryOp) {
|
|||
EXPECT_TRUE(match);
|
||||
EXPECT_EQ(Src0, Copies[0]);
|
||||
EXPECT_EQ(Src1, TruncCopy1.getReg(0));
|
||||
|
||||
// Match shl, and make sure a different shift amount type works.
|
||||
auto Shl = B.buildShl(s64, Copies[0], TruncCopy1);
|
||||
match = mi_match(Shl.getReg(0), *MRI,
|
||||
m_GShl(m_Reg(Src0), m_Reg(Src1)));
|
||||
EXPECT_TRUE(match);
|
||||
EXPECT_EQ(Src0, Copies[0]);
|
||||
EXPECT_EQ(Src1, TruncCopy1.getReg(0));
|
||||
}
|
||||
|
||||
TEST_F(AArch64GISelMITest, MatchICmp) {
|
||||
|
|
Loading…
Reference in New Issue