From 67abc10616618b7b7f3ebd873d4903893bf90544 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Nov 2008 04:33:10 +0000 Subject: [PATCH] add a new template for matching a select between two constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59391 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/PatternMatch.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 2408103cb94..f5356a6edd2 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -367,6 +367,17 @@ m_Select(const Cond &C, const LHS &L, const RHS &R) { return SelectClass_match(C, L, R); } +/// m_SelectCst - This matches a select of two constants, e.g.: +/// m_SelectCst(m_Value(V), -1, 0) +template +inline SelectClass_match +m_SelectCst(const Cond &C, int64_t L, int64_t R) { + return SelectClass_match(C, m_ConstantInt(L), + m_ConstantInt(R)); +} + + //===----------------------------------------------------------------------===// // Matchers for CastInst classes // -- 2.34.1